国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

jquery左右滾動焦點圖banner圖片鼠標經過顯示上下頁按鈕

2024-05-06 15:52:57
字體:
來源:轉載
供稿:網友
jquery左右滾動焦點圖banner圖片,鼠標經過顯示上下頁,適合寬和高都比較大的頁面使用附演示,感興趣的朋友可以參考下

jquery左右滾動焦點圖banner圖片,鼠標經過顯示上下頁
適合寬和高都比較大的頁面使用

jquery左右滾動焦點圖banner圖片鼠標經過顯示上下頁按鈕

 
演示

復制代碼 代碼如下:


<div>
<div>
<ul>
<li><a target="_blank">
<img src="../dandong.png" /></a></li>
<li><a target="_blank">
<img src="../mohe.png" /></a></li>
<li><a target="_blank">
<img src="../changbaishan.png" /></a></li>
<li><a target="_blank">
<img src="../erlianhaote.png" /></a></li>
</ul>
</div>
</div>


復制代碼 代碼如下:


@charset "utf-8";
img { border: 0px; }
.bannerbox { width: 320px; height: 150px; overflow: hidden; margin: 0px auto; }
#focus { width: 320px; height: 150px; clear: both; overflow: hidden; position: relative; float: left; }
#focus ul { width: 320px; height: 150px; float: left; position: absolute; clear: both; padding: 0px; margin: 0px; }
#focus ul li { float: left; width: 320px; height: 150px; overflow: hidden; position: relative; padding: 0px; margin: 0px; }
#focus .preNext { width: 250px; height: 150px; position: absolute; top: 0px; cursor: pointer; }
#focus .pre { left: 0; background: url(../images/sprite.png) no-repeat left center; }
#focus .next { rightright: 0; background: url(../images/sprite1.png) no-repeat rightright center; }


js文件

復制代碼 代碼如下:


$(function () {
var sWidth = $("#focus").width();
var len = $("#focus ul li").length;
var index = 0;
var picTimer;
var btn = "<div></div><div>";
for (var i = 0; i < len; i++) {
btn += "<span></span>";
}
btn += "</div><div></div><div></div>";
$("#focus").append(btn);
$("#focus .btnBg").css("opacity", 0);
$("#focus .btn span").css("opacity", 0.4).mouseenter(function () {
index = $("#focus .btn span").index(this);
showPics(index);
}).eq(0).trigger("mouseenter");
$("#focus .preNext").css("opacity", 0.0).hover(function () {
$(this).stop(true, false).animate({ "opacity": "0.5" }, 300);
}, function () {
$(this).stop(true, false).animate({ "opacity": "0" }, 300);
});
$("#focus .pre").click(function () {
index -= 1;
if (index == -1) { index = len - 1; }
showPics(index);
});
$("#focus .next").click(function () {
index += 1;
if (index == len) { index = 0; }
showPics(index);
});
$("#focus ul").css("width", sWidth * (len));
$("#focus").hover(function () {
clearInterval(picTimer);
}, function () {
picTimer = setInterval(function () {
showPics(index);
index++;
if (index == len) { index = 0; }
}, 2800);
}).trigger("mouseleave");
function showPics(index) {
var nowLeft = -index * sWidth;
$("#focus ul").stop(true, false).animate({ "left": nowLeft }, 300);
$("#focus .btn span").stop(true, false).animate({ "opacity": "0.4" }, 300).eq(index).stop(true, false).animate({ "opacity": "1" }, 300);
}
});

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 象山县| 岢岚县| 曲阜市| 疏附县| 阿城市| 德庆县| 湘乡市| 宿州市| 凤翔县| 常山县| 营口市| 五华县| 湖州市| 石阡县| 阆中市| 尼木县| 遵义县| 永平县| 芦山县| 安顺市| 内丘县| 西青区| 雅安市| 娱乐| 封丘县| 滨海县| 墨脱县| 和龙市| 南澳县| 大厂| 微博| 运城市| 霞浦县| 五原县| 苍山县| 赣州市| 沅江市| 库伦旗| 大化| 曲麻莱县| 浠水县|