可关闭的jQuery焦点图特效是一款全屏图片轮播,功能很强大且很实用和常用的jquery特效。
$(function() {
if ($.cookie("weijuju_banner_10") != 1) {
var f = $(window).width() * 0.39375;
$("#online_qq_layer").hide();
$("#focus").height(f);
$("#focus ul li").width($(window).width());
$("#top_banner").show().animate({
height: f + "px"
},
2000);
$(".top_banner_close").click(function() {
$("#top_banner").remove();
var h = new Date();
h.setTime(h.getTime() + (12 * 60 * 60 * 1000));
$.cookie("weijuju_banner_10", "1", {
expires: h
});
$("#online_qq_layer").show()
});
var j = $("#focus").width();
var a = $("#focus ul li").length;
var c = 0;
var g;
var e = "<div class='btnBg'></div><div class='btn'>";
for (var d = 0; d < a; d++) {
e += "<span></span>"
}
e += "</div><div class='preNext pre'></div><div class='preNext next'></div>";
$("#focus").append(e);
$("#focus .btnBg").css("opacity", 0.5);
$("#focus .btn span").css("opacity", 0.4).mouseover(function() {
c = $("#focus .btn span").index(this);
b(c)
}).eq(0).trigger("mouseover");
$("#focus .preNext").css("opacity", 0.2).hover(function() {
$(this).stop(true, false).animate({
opacity: "0.5"
},
300)
},
function() {
$(this).stop(true, false).animate({
opacity: "0.2"
},
300)
});
$("#focus .pre").click(function() {
c -= 1;
if (c == -1) {
c = a - 1
}
b(c)
});
$("#focus .next").click(function() {
c += 1;
if (c == a) {
c = 0
}
b(c)
});
$("#focus ul").css("width", j * (a));
$("#focus").hover(function() {
clearInterval(g)
},
function() {
g = setInterval(function() {
b(c);
c++;
if (c == a) {
c = 0
}
},
5000)
}).trigger("mouseleave");
function b(h) {
var i = -h * j;
$("#focus ul").stop(true, false).animate({
left: i
},
300);
$("#focus .btn span").stop(true, false).animate({
opacity: "0.4"
},
300).eq(h).stop(true, false).animate({
opacity: "1"
},
300)
}
}
});