js跑马灯效果、横向、纵向滚动效果
比如横向滚动,则在li标签里设置 display: table-cell;滚动效果 transform: translateX(-200px);
<div id="div1" >
<ul>
<li><img src="imgs/Snipaste_2022-11-22_18-13-13.png"></li>
<li><img src="imgs/Snipaste_2022-11-23_11-31-25.png"></li>
<li><img src="imgs/Snipaste_2022-11-22_18-13-13.png"></li>
<li><img src="imgs/Snipaste_2022-11-23_11-31-25.png"></li>
<li><img src="imgs/Snipaste_2022-11-22_18-13-13.png"></li>
<li><img src="imgs/Snipaste_2022-11-23_11-31-25.png"></li>
</ul>
</div>
<style>
#div1
{
overflow: hidden;
position: absolute;
width: 204px;
height: 117px;
left: 1px;
top: 2px;
border-radius: 8px;
}
#div1 ul
{
position: absolute;
left:0;
list-style: none;
animation: marquee 13s linear infinite;
}
#div1 ul li
{
padding: 1px;
/* 纵向滚动 */
/* display: inline; */
/* 横向滚动 */
display: table-cell;
width: 202px;
height: 117px;
}
#div1 ul li img
{
width: 202px;
height: 117px;
}
@keyframes marquee{
0% {
}
100% {
/* 横向是translateX,纵向是translateY */
transform: translateX(-200px);
}
}
</style>
原文地址:https://blog.csdn.net/weixin_44248903/article/details/142449936
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!