注:请在移动端查看效果,PC端预览无效果
引用jquery和leftScroll.js,leftScroll.css
<link rel="stylesheet" href="css/leftScroll.css"> <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script> <script src="script/leftScroll.js"></script>
html结构
<div class="leftScroll"> <ul class="leftScroll_container"> <li class="leftScroll_picBox"> <a href=""> <img class="leftScroll_picBox_img" src="./img/shop.png" alt=""> </a> </li> <li class="leftScroll_picBox"> <a href=""> <img class="leftScroll_picBox_img" src="./img/shop2.png" alt=""> </a> </li> <li class="leftScroll_picBox"> <a href=""> <img class="leftScroll_picBox_img" src="./img/shop3.png" alt=""> </a> </li> <li class="leftScroll_picBox"> <a href=""> <img class="leftScroll_picBox_img" src="./img/shop4.png" alt=""> </a> </li> <li class="leftScroll_picBox"> <a href=""> <img class="leftScroll_picBox_img" src="./img/shop5.png" alt=""> </a> </li> </ul> </div>
js调用
$(".leftScroll").leftScroll();