现在我的代码使徽标从右到左动画化,一旦结束,它就会重新启动。我怎样才能让它继续循环,以便在新循环开始时第一个徽标跟随最后一个徽标?
编辑:我宁愿不使用额外的 js 库,所以如果有一种使用 jquery 执行此操作的简单方法会更好
img {
width: 100px;
}
.marquee {
position: relative;
width: 100%;
height: 100px;
border: 1px solid black;
overflow: hidden;
}
.marquee div {
display: block;
position: absolute;
width: 300%;
overflow: hidden;
animation: marquee 20s linear infinite;
}
.marquee div:hover {
animation-play-state: paused;
}
.marquee span {
float: left;
width: 50%;
}
@keyframes marquee {
0% { left: 0; }
100% { left: -100%; }
}
<div class="marquee">
<div>
<img src="http://static.bragdeal.com/logo.png" alt="">
<img src="http://static.bragdeal.com/logo.png" alt="">
<img src="http://static.bragdeal.com/logo.png" alt="">
<img src="http://static.bragdeal.com/logo.png" alt="">
<img src="http://static.bragdeal.com/logo.png" alt="">
<img src="http://static.bragdeal.com/logo.png" alt="">
<img src="http://static.bragdeal.com/logo.png" alt="">
<img src="http://static.bragdeal.com/logo.png" alt="">
</div>
</div>
原文由 BragDeal 发布,翻译遵循 CC BY-SA 4.0 许可协议
HTML:
CSS:
脚本:
这就是我使用 JQuery Marquee 使其运行所做的工作。
外部链接:
你也可以关注这个 小提琴