- 引入文件:
<script src="imgScroll.js"></script>
- 创建对象:
var s = new Scroll(elem, imgWidth, imgNums);
- 调用play方法:
s.play();
<div class="container">
<div class="list" style="left: -600px">
<img src="img/5.jpg">
<img src="img/1.jpg">
<img src="img/2.jpg">
<img src="img/3.jpg">
<img src="img/4.jpg">
<img src="img/5.jpg">
<img src="img/1.jpg">
</div>
<span id="prev" class="btn"><</span>
<span id="next" class="btn">></span>
</div>