function showbg(e) { var t = $("#flashs .btn span").index($("#flashs .btn span.cur")); t < 0 && (t = 0), $("#flashs .btn span.cur").css("opacity", .7).removeclass("cur"), $("#flashbg" + t).css({ opacity: 0, "z-index": 1 }), $("#flashbg" + showindex).css({ "z-index": 2 }), $("#flashbg" + showindex).animate({ opacity: 1 }, 500), $("#flashs .btn span").eq(showindex).css("opacity", 1).addclass("cur") } var showindex = 1, h = $("#flashs div.bgitem").css("opacity", 0).length, btn = "
"; for (var i = 0; i < h; i++) btn += "" + (i + 1) + ""; btn += "
", $("#flashs").append(btn), $("#flashs .btn span").css("opacity", .7).mouseenter(function () { showindex = $("#flashs .btn span").index(this), showbg(showindex) }).eq(0).trigger("mouseenter"), $("#flashs").hover(function () { clearinterval(pictimer) }, function () { pictimer = setinterval(function () { showindex++, showindex == h && (showindex = 0), showbg(showindex) }, 3000) }).eq(0).trigger("mouseleave")