循环无缝滚动的列表知识点
- 动态渲染列表,高度动态计算
- 过渡动画
- css3 animation 动画
- style 动态修改 top动画
https://github.com/chenxuan0000/seamless-scroll/blob/master/src/content/seamless.js
https://github.com/chenxuan0000/vue-seamless-scroll/blob/master/src/components/myClass.vue
https://juejin.cn/post/6983595654652100616
https://www.jb51.net/article/178366.htm
https://www.jq22.com/demo/jqueryslide202004132315/
https://dev.to/dhilipkmr/creating-infinite-scroll-with-15-elements-4dg4
https://juejin.cn/post/7141304226470166565
Creating Infinite Scroll with 15 Elements
hooks 无缝轮动
https://blog.csdn.net/weixin_44952328/article/details/124150886
seamless-scroll
https://github.com/chenxuan0000/seamless-scroll
yarn add seamscroll
在线案例 https://chenxuan0000.github.io/seamless-scroll
seamless源码 https://github.com/chenxuan0000/seamless-scroll/blob/master/src/content/seamless.js
import React, { useEffect, useRef, memo } from 'react';import { array } from 'prop-types';import * as seamless from 'seamscroll';import { isEqual } from 'lodash';import cls from 'classnames';import styles from './style.module.less';SeamlessList.propTypes = {dataSource: array.isRequired,};function SeamscrollList({ dataSource }) {const domRef = useRef(null);useEffect(() => {if (!domRef.current) return;seamless.init({dom: domRef.current,direction: 1, // 向上滚动 0 👇🏻; 1 👆🏻; 2 👈🏻; 3 👉🏻// step: 3, // 一次轮播多少个,默认一个singleHeight: 40, // 行高waitTime: 3000, // 单步滚动等待 3s});}, []);return (<section className={styles.container}><ul ref={domRef}>{dataSource.map((it, index) => (<li className={styles.item}><span className={styles.col}>序号</span><a className={styles.col}>详情链接</a><b className={styles.col}>字段</b><time className={styles.col}>时间</time></li>))}</ul></section>);}function propsEqual({ dataSource }, props) {return isEqual(dataSource, props.dataSource);}export default memo(SeamscrollList, propsEqual);
style.module.less
.container {position: relative;height: 400px;overflow: hidden;.item {display: flex;height: 40px;line-height: 40px;cursor: pointer;&:nth-child(odd) {background-color: rgba(56, 66, 86, 0.6);}&:hover {background: rgba(250, 250, 250, 0.06);}}.col {flex: 1;padding-inline: 8px;}}
owl carousel轮播
依赖 jquery
https://owlcarousel2.github.io/OwlCarousel2/demos/demos.html
