更新时间:2017/11/27 下午3:32:23
更新说明:修复点击左边箭头展示区图片没有变化的bug
引用jQuery库
<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
html
<div class="tm-m-photos"> <ul class="tm-m-photos-thumb"> <li data-src="img/a1.png"> <img src="img/a1.png"> <b class="tm-photos-arrow"></b> </li> <li data-src="img/a2.png"> <img src="img/a2.png"> <b class="tm-photos-arrow"></b> </li> <li data-src="img/a3.png"> <img src="img/a3.png"> <b class="tm-photos-arrow"></b> </li> <li data-src="img/a4.png"> <img src="img/a4.png"> <b class="tm-photos-arrow"></b> </li> </ul> <div class="tm-m-photo-viewer transition1"> <img src="img/a1.png"> <a class="tm-m-photo-viewer-navleft" style="cursor: default;"> <i class="tm-m-photo-viewer-navicon arrow-right"><</i> </a> <a class="tm-m-photo-viewer-navright" data-spm-anchor-id="a220o.1000855.0.0" style="cursor: pointer;"> <i class="tm-m-photo-viewer-navicon arrow-right">></i> </a> </div> </div>
dom结构调用
$(function () { var obj = new commentMove('.tm-m-photos', '.tm-m-photo-viewer'); obj.init() })
我发现多处用到 用同一个类名 的话 会相互影响的