CSS:跑马灯

html 复制代码
<div class="swiper-container">
	<div class="swiper-wrapper">
		<!-- 第一组 -->
		<div class="item" v-for="item in cardList" :key="'first-'+item.id">
			<img :src="item.image" alt="" class="mb-15">
		</div>
		<!-- 第二组(用于无缝衔接) -->
		<div class="item" v-for="item in cardList" :key="'second-'+item.id">
			<img :src="item.image" alt="" class="mb-15">
		</div>
	</div>
</div>
css 复制代码
.swiper-container {
	width: 100%;
    overflow: hidden;
    padding: 0 .4rem;
    position: relative;
}

.swiper-wrapper {
    display: flex;
    animation: scroll 30s linear infinite;
    width: fit-content; // 确保容器宽度适应内容
}

.item {
    flex-shrink: 0;
    width: 2.2rem;
    height: 2.84rem;
    background: #FFFFFF;
    border-radius: .2rem;
    border: .1rem solid #B0B0AC;
    margin-right: .3rem;
    img{
        width: 2rem;
        height: 2rem;
    }
}
@keyframes scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-50%)); // 移动一半距离,确保无缝衔接
    }
}
相关推荐
赖龙5 小时前
pnpm vs npm
前端·npm·node.js
学如逆水,不进则退6 小时前
在线免费音频剪辑:NBTools 可视化波形裁剪 MP3/WAV,本地处理免上传
前端·音视频
Mh6 小时前
虚拟滚动真的比普通滚动性能更好吗?
前端·javascript·性能优化
pe7er6 小时前
React + Ant Design 中的 IME (输入法合成)安全输入组件
前端
Super 含7 小时前
Android 启动优化(二):TTID、TTFD 与 Macrobenchmark 启动性能测量
前端
Python私教7 小时前
别急着加 llms.txt:企业官网面向 AI 搜索的工程清单
前端·人工智能·seo
东方小月7 小时前
从零开发一个 Coding Agent(十三):实现安全的 read 文件读取工具
前端·人工智能·全栈
东方小月8 小时前
从零开发一个 Coding Agent(十二):实现版本化 JSONL 与真实 CLI 入口
前端·设计模式·前端框架
FL16238631299 小时前
室内易燃物识别易燃评估室内易燃程度识别分割数据集labelme格式1015张85类别
java·服务器·前端
用户059540174469 小时前
把 AI 长期记忆去重测试从 20 分钟压到 40 秒,重复率从 18% 干到 1.5%
前端·css