麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > JavaScript > 正文

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

2019-11-20 21:54:17
字體:
供稿:網(wǎng)友
jquery左右滾動焦點圖banner圖片,鼠標經(jīng)過顯示上下頁
適合寬和高都比較大的頁面使用
 
演示
復(fù)制代碼 代碼如下:

<div class="bannerbox">
<div id="focus">
<ul>
<li><a target="_blank">
<img src="../dandong.png" alt="" /></a></li>
<li><a target="_blank">
<img src="../mohe.png" alt="" /></a></li>
<li><a target="_blank">
<img src="../changbaishan.png" alt="" /></a></li>
<li><a target="_blank">
<img src="../erlianhaote.png" alt="" /></a></li>
</ul>
</div>
</div>

復(fù)制代碼 代碼如下:

@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文件
復(fù)制代碼 代碼如下:

$(function () {
var sWidth = $("#focus").width();
var len = $("#focus ul li").length;
var index = 0;
var picTimer;
var btn = "<div class='btnBg'></div><div class='btn'>";
for (var i = 0; i < len; i++) {
btn += "<span></span>";
}
btn += "</div><div class='preNext pre'></div><div class='preNext next'></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);
}
});
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 久久艹艹艹| 国产成人高清成人av片在线看 | 国产一级二级在线播放 | 韩国精品视频在线观看 | 91精选视频在线观看 | 一区二区三区在线观看av | 亚洲精品一区二区三区免 | 91av爱爱| 视频一区国产 | 激情亚洲一区二区 | 狠狠干b| 中文字幕网在线 | 女人裸体让男人桶全过程 | 羞羞答答www网站进入 | 美女亚洲综合 | 日本黄色一级电影 | 欧美一级视频网站 | 亚洲电影在线观看高清免费 | 99亚洲伊人久久精品影院红桃 | 久久99精品国产99久久6男男 | 国产精品啪一品二区三区粉嫩 | 日韩视频一 | 在线视频 日韩 | 欧美日韩经典在线 | 黄色av免费网站 | 欧美性猛交xxxxx按摩国内 | 国产精品久久久久久婷婷天堂 | 2019中文字幕在线播放 | 亚洲国产超高清a毛毛片 | 午夜精品福利视频 | h视频免费在线 | www久久国产 | 欧美日本一区二区 | 中文字幕电影免费播放 | 操操操操网 | 欧美雌雄另类xxxxx | 91女上位 在线播放 性欧美日本 | 精品国产精品久久 | 亚洲精品久久久久久久久久 | 国产精品久久久久久久久久大牛 | 91短视频在线免费观看 |