PC端上实现图片轮播效果很简单,只要通过使用click事件就可以非常简单的实现效果,但是在移动端上,就要通过核心的touch事件来实现。
下面是移动端手指滑动轮播图的完整代码。
*{margin:0;padding:0;} li{list-style:none;} .lb{width:320px;height:130px;position:relative;margin:20px auto;overflow: hidden;} .lb .lb_img{width:2240px;height:130px;position:absolute;left:-320px;} .lb .lb_img img{width:320px;height:130px;float:left;display:block;} .lb ul{width:35px;height:4px;position:absolute;bottom:10px;left:50%;margin-left:-15px;} .lb ul li{width:4px;height:4px;border-radius:2px;border:0.25px solid #fff;margin-left:2.5px;background:#666;float:left;cursor:pointer;} .lb ul .active{background:#fff;} .lb ul li:hover{background:#fff;}
以上这篇原生js实现移动端触摸轮播的示例代码就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持考高分网。



