$(function () { var timer = 5000; var showtime = 800; var showbox = $("#banner_show"); var inbox = $(".bannger_inbox"); var movelist = $("#ty_banner_list"); var s; var b = 0; var size = inbox.size(); var play = 1; function move() { b++; if (b > size - 1) { b = 0; } inbox.each(function (e) { inbox.eq(e).hide(0); $("#banner_magbox" + e).hide(); movelist.find("a").eq(e).removeclass("hover"); if (e == b) { inbox.eq(b).fadein(showtime); $("#banner_magbox" + b).show(); movelist.find("a").eq(b).addclass("hover"); } }); } s = setinterval(move, timer); function stopp(obj) { $(obj).hover(function () { if (play) { clearinterval(s); play = 0; } }, function () { if (!play) { s = setinterval(move, timer); play = 1; } } ); } stopp(".banner_show"); $(".banner_btn_right").click(function () { move(); }); $(".banner_btn_left").click(function () { b--; if (b < 0) { b = size - 1 } inbox.each(function (e) { inbox.eq(e).hide(0); movelist.find("a").eq(e).removeclass("hover"); if (e == b) { inbox.eq(b).fadein(showtime); movelist.find("a").eq(b).addclass("hover"); } }); }); movelist.find("a").click(function () { var rel = $(this).attr("rel"); inbox.each(function (e) { inbox.eq(e).hide(0); movelist.find("a").eq(e).removeclass("hover"); $("#banner_magbox" + e).hide(0); if (e == rel) { inbox.eq(rel).fadein(showtime); movelist.find("a").eq(rel).addclass("hover"); $("#banner_magbox" + rel).show(0); } }); }); $(".bannger_inbox").each(function (e) { var inboxsize = $(".bannger_inbox").size(); inboxwimg = $(this).find("img").width(); $(".bannger_inbox").eq(e).css({ "margin-left": (-1) * inboxwimg / 2 + "px", "z-index": inboxsize - e }); }); $(".banner").hover( function () { $(".banner_pre_next").fadein(); }, function () { $(".banner_pre_next").fadeout(); }) }); /*menu*/ $(function () { var tt1; $(".content_bottom_tig").bind({ mouseenter: function () { $(this).find(".h_bg").addclass("hover"); that = $(this) tt1 = settimeout(function () { that.animate({ height: 130 }); }, 200); }, click: function () {}, mouseleave: function () { $(this).find(".h_bg").removeclass("hover"); cleartimeout(tt1); that.animate({ height: 25 }); } }); })