$(function() { $.com(".scroll").PageScroll({speed:800, easing:"easeOutCubic"}); /* topslide */ $("#topimg").each(function() { var total = 0; var num = 1; var backnum = 1; var timerID; var slideSec = 6000; sImg(); function sImg(){ $("#topimg > div",this.gtoup).each(function(){ total++; $(this).css("z-index","0"); $(this).hide(); }).filter(':eq(0)').css({"z-index": "1"}).show(); if(total>1){ timerID = setInterval(moveEvent,slideSec); } } function moveEvent(){ if(num < total){ slide(num+1); }else{ slide(1); } } function slide(n){ clearInterval(timerID); $("#topimg > div",this.gtoup).each(function(){ $(this).css("z-index","0"); $(this).hide(); }); $("div#ptn_"+backnum).css({"z-index": "1"}).show(); $("div#ptn_"+n).css({"z-index": "0"}); $("div#ptn_"+n).show(); $("div#ptn_"+backnum).stop(true, false).queue([]).animate({ opacity: 0 },{duration:1500, easing:"linear", queue:false, complete: function() { $(this).hide(); $(this).css({ opacity: 1 }); timerID = setInterval(moveEvent,slideSec); backnum = n; } }); num = n; } }); });