//全屏滚动 $(function () { var n = 0; var imglength = $(".b-img a").length; var ctwidth = imglength * 100; var itemwidth = (1 / imglength) * 100; $(".b-img").width(ctwidth + "%"); $(".b-img a").width(itemwidth + "%"); $(".b-list").width(imglength * 30); if (imglength > 1) { for (var i = 0; i < imglength; i++) { var listspan = $(""); $(".b-list").append(listspan); } } $(".b-list span:eq(0)") .addclass("spcss") .siblings("span") .removeclass("spcss"); $(".bar-right em").click(function () { if (n == imglength - 1) { var ctposit = (n + 1) * 100; $(".banner").append($(".b-img").clone()); $(".b-img:last").css("left", "100%"); $(".b-img:first").animate({ left: "-" + ctposit + "%" }, 1000); $(".b-img:last").animate({ left: "0" }, 1000); var settime0 = settimeout(function () { $(".banner .b-img:first").remove(); }, 1000); n = 0; $(".b-list span:eq(" + n + ")") .addclass("spcss") .siblings("span") .removeclass("spcss"); } else { n++; var ctposit = n * 100; $(".b-img").animate({ left: "-" + ctposit + "%" }, 1000); $(".b-list span:eq(" + n + ")") .addclass("spcss") .siblings("span") .removeclass("spcss"); } }); $(".bar-left em").click(function () { if (n == 0) { var stposit = imglength * 100; var etposit = (imglength - 1) * 100; $(".banner").prepend($(".b-img").clone()); $(".b-img:first").css("left", "-" + stposit + "%"); $(".b-img:last").animate({ left: "100%" }, 1000); $(".b-img:first").animate({ left: "-" + etposit + "%" }, 1000); var settime0 = settimeout(function () { $(".banner .b-img:last").remove(); }, 1000); n = imglength - 1; $(".b-list span:eq(" + n + ")") .addclass("spcss") .siblings("span") .removeclass("spcss"); } else { n--; var ctposit = n * 100; $(".b-img").animate({ left: "-" + ctposit + "%" }, 1000); $(".b-list span:eq(" + n + ")") .addclass("spcss") .siblings("span") .removeclass("spcss"); } }); $(".b-list span").click(function () { var lsindex = $(this).index(); n = lsindex; var ctposit = n * 100; $(".b-img").animate({ left: "-" + ctposit + "%" }, 1000); $(this).addclass("spcss").siblings("span").removeclass("spcss"); }); function rollenvent() { if (n == imglength - 1) { var ctposit = (n + 1) * 100; $(".banner").append($(".b-img").clone()); $(".b-img:last").css("left", "100%"); $(".b-img:first").animate({ left: "-" + ctposit + "%" }, 1000); $(".b-img:last").animate({ left: "0" }, 1000); var settime0 = settimeout(function () { $(".banner .b-img:first").remove(); }, 1000); n = 0; $(".b-list span:eq(0)") .addclass("spcss") .siblings("span") .removeclass("spcss"); } else { n++; var ctposit = n * 100; $(".b-img").animate({ left: "-" + ctposit + "%" }, 1000); $(".b-list span:eq(" + n + ")") .addclass("spcss") .siblings("span") .removeclass("spcss"); } } var slidesetinterval = setinterval(rollenvent, 4000); $(".banner").hover( function () { clearinterval(slidesetinterval); }, function () { slidesetinterval = setinterval(rollenvent, 4000); } ); $(".bar-left") .mouseover(function () { $(this).css("background", "url(images/arr-bg.png)"); $(this).find("em").addclass("emcss"); }) .mouseleave(function () { $(this).css("background", "none"); $(this).find("em").removeclass("emcss"); }); $(".bar-right") .mouseover(function () { $(this).css("background", "url(images/arr-bg.png)"); $(this).find("em").addclass("emcss"); }) .mouseleave(function () { $(this).css("background", "none"); $(this).find("em").removeclass("emcss"); }); });