利用ScrollPicLeft.js這個(gè)庫(kù)實(shí)現(xiàn)圖片的前后切換,適用于網(wǎng)頁(yè)中的證書展示、推薦商品之類的欄目。它不像傳統(tǒng)的marquee滾動(dòng)那樣,而是可以手動(dòng)的去點(diǎn)擊前后切換箭頭按鈕,進(jìn)行圖片的翻頁(yè),從而達(dá)到瀏覽上一張,下一張的效果。
不需要調(diào)用jquery,初始化簡(jiǎn)單,使用非常的簡(jiǎn)單,便利。
實(shí)例效果:

js代碼:
<script type="text/javascript"> var scrollPhoto = new ScrollPicleft(); scrollPhoto.scrollContId = "ISL_Photo"; // 內(nèi)容容器ID"" scrollPhoto.arrLeftId = "Left_Photo";//左箭頭ID scrollPhoto.arrRightId = "Right_Photo"; //右箭頭ID scrollPhoto.frameWidth = 450;//顯示框?qū)挾?scrollPhoto.pageWidth = 150; //翻頁(yè)寬度 scrollPhoto.speed = 10; //移動(dòng)速度(單位毫秒,越小越快) scrollPhoto.space = 10; //每次移動(dòng)像素(單位px,越大越快) scrollPhoto.autoPlay = false; //自動(dòng)播放 scrollPhoto.autoPlayTime = 3; //自動(dòng)播放間隔時(shí)間(秒) scrollPhoto.initialize(); //初始化 </script>
本文實(shí)例講述了js圖片輪播手動(dòng)切換效果。分享給大家供大家參考。具體如下:
這是一款基于js圖片輪播手動(dòng)切換效果代碼,實(shí)現(xiàn)過(guò)程很簡(jiǎn)單。
為大家分享的js圖片輪播手動(dòng)切換效果代碼如下
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>js圖片輪播手動(dòng)切換效果</title><script type="text/javascript" src="js/ScrollPicLeft.js"></script><style>html,body,ul,li{margin:0; padding:0;}ul,li{ list-style:none;}.dd_main{ width:520px;}.zl_left { width:35px; float:left; text-align:left; padding-top:60px}.zl_right { width:35px; float:right; text-align:right; padding-top:60px}.zl_content { width:450px; height:153px; float:left; overflow:hidden;}.zl_content ul li { width:130px; padding:0 10px; text-align:center; float:left;}.welcome{ position:fixed; width:100%; text-align:center; bottom:30px;}.welcome a{ color:#0350B8;}</style></head><body><div class="dd_main">  <div class="zl_left" id="Left_Photo"><a href="javascript:void(0)"><img src="images/zl_tb1.jpg" width="24" height="32" /></a></div> <div class="zl_content"> <ul id="ISL_Photo"> <li><img src="images/zl_tp.jpg" width="130" height="153" /></li> <li><img src="images/zl_tp.jpg" width="130" height="153" /></li> <li><img src="images/zl_tp.jpg" width="130" height="153" /></li> <li><img src="images/zl_tp.jpg" width="130" height="153" /></li> <li><img src="images/zl_tp.jpg" width="130" height="153" /></li> <li><img src="images/zl_tp.jpg" width="130" height="153" /></li> <li><img src="images/zl_tp.jpg" width="130" height="153" /></li> </ul> </div> <div class="zl_right" id="Right_Photo"><a href="javascript:void(0)"><img src="images/zl_tb2.jpg" width="24" height="32" /></a></div></div><script type="text/javascript"> var scrollPhoto = new ScrollPicleft(); scrollPhoto.scrollContId = "ISL_Photo"; // 內(nèi)容容器ID"" scrollPhoto.arrLeftId = "Left_Photo";//左箭頭ID scrollPhoto.arrRightId = "Right_Photo"; //右箭頭ID scrollPhoto.frameWidth = 450;//顯示框?qū)挾?scrollPhoto.pageWidth = 150; //翻頁(yè)寬度 scrollPhoto.speed = 10; //移動(dòng)速度(單位毫秒,越小越快) scrollPhoto.space = 10; //每次移動(dòng)像素(單位px,越大越快) scrollPhoto.autoPlay = false; //自動(dòng)播放 scrollPhoto.autoPlayTime = 3; //自動(dòng)播放間隔時(shí)間(秒) scrollPhoto.initialize(); //初始化 </script></body></html>源碼下載:js圖片輪播手動(dòng)切換效果
精彩專題分享:jQuery圖片輪播 JavaScript圖片輪播 Bootstrap圖片輪播
以上就是為大家分享的js圖片輪播手動(dòng)切換效果代碼,希望大家可以喜歡,并應(yīng)用到實(shí)踐中。
| 
 
 | 
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注