var curindex = 0; var time = 800; var slidetime = 5000; var adtxt = $("#banner_img>li>div>.ad_txt"); var adimg = $("#banner_img>li>div>.ad_img"); var int = setinterval("autoslide()", slidetime); $("#banner_ctr>ul>li ").click(function () { show($(this).index("#banner_ctr>ul>li ")); window.clearinterval(int); int = setinterval("autoslide()", slidetime); }); function autoslide() { curindex + 1 >= $("#banner_img>li").size() ? curindex = -1 : false; show(curindex + 1); } function show(index) { $.easing.def = "easeoutquad"; $("#drag_arrow").stop(false, true).animate({ left: index * 123 + 20 }, 300); $("#banner_img>li").eq(curindex).stop(false, true).fadeout(time); adtxt.eq(curindex).stop(false, true).animate({ top: "70px" }, time); adimg.eq(curindex).stop(false, true).animate({ right: "120px" }, time); settimeout(function () { $("#banner_img>li").eq(index).stop(false, true).fadein(time); adtxt.eq(index).children("p").css({ paddingtop: "50px", paddingbottom: "50px" }).stop(false, true).animate({ paddingtop: "0", paddingbottom: "0" }, time); adtxt.eq(index).css({ top: "0", opacity: "0" }).stop(false, true).animate({ top: "70px", opacity: "1" }, time); adimg.eq(index).css({ right: "-50px", opacity: "0" }).stop(false, true).animate({ right: "10px", opacity: "1" }, time); }, 200) curindex = index; }