注意css
1.焦點圖初始化ID和圖片最外層ID保持一致html
2.圖片列表外面必須包裹一個div,且id必須爲picapi
http://demo.jb51.net/js/myfocus/tutorials.htmlide
http://demo.jb51.net/js/myfocus/api.htmlspa
<script src="js/myfocus-2.0.1.min.js"></script>
<script src="js/mf-pattern/mF_YSlider.js"></script>
<link href="js/mf-pattern/mF_YSlider.css" rel="stylesheet" type="text/css">.net
<script>
myFocus.set({
id:'picBox'
pattern:'mF_YSlider'//樣式設計
})
</script>
htm
<div class="ad" id="picBox">圖片
<div class="loading">
<img src="images/loading.gif">
</div>ip
<div class="pic">
<ul>
<li><img src="images/ad2.jpg"></li>
<li><img src="images/ad3.jpg"></li>
<li><img src="images/ad4.jpg"></li>
</ul>
</div>
</div><!--ad-->
ps:樣式設計的時候要把多餘的部分隱藏
使用overflow的時候要設置寬度
.ad{ height: 280px; width: 100%; overflow: hidden;}