有N张图片无限滚动轮播。代码如下。
1 <div class="partnerCont"> 2 <div class="cont"> 3 <div class="list"> 4 <div class="item" v-for="item in 10"> 5 {{ item }} 6 <img src="/src/assets/images/notData.png" alt="logo"> 7 </div> 8 <!-- 重复放两个相同的内容是为了无缝滚动,防止突兀空缺跳动--> 9 <div class="item" v-for="item in 10"> 10 {{ item }} 11 <img src="/src/assets/images/notData.png" alt="logo"> 12 </div> 13 </div> 14 </div> 15 </div>
1 .partnerCont { 2 width: 1000px; 3 margin: auto; 4 5 .cont { 6 overflow: hidden; 7 8 .list { 9 display: flex; 10 animation: partnerSWiper 25s linear infinite normal; 11 12 .item { 13 height: 130px; 14 width: 150px; 15 flex: none; 16 text-align: center; 17 18 img { 19 height: 100px; 20 display: block; 21 margin: auto; 22 } 23 } 24 } 25 } 26 27 @keyframes partnerSWiper { 28 0% { 29 transform: translateZ(0); 30 } 31 100% { 32 //1500px:10个内容区域,每个宽度150px,10*150=1500px 33 transform: translate3d(-1500px, 0, 0); 34 } 35 } 36 }
标签:10,轮播,item,1500px,跑马灯,图片 From: https://www.cnblogs.com/HE0318bei/p/16828823.html