var BannerTotal; var BannerTime; var Banneri; $(function(){ BannerTotal = $("#Banner .pic li").length; for(var i=0;i"; $("#Banner .btn").append("
  • "); } $("#Banner .btn li").hover(function(){ BannerPicShow($(this).index()) },function(){ return ; }) Banneri = 0; BannerPicShow(Banneri); BannerTime = setTimeout(BannerAuto,7000); $("#Banner .next").click(function(){ Banneri++; if(Banneri>=BannerTotal){ Banneri=0; } $("#Banner .pic li").eq(Banneri).css("z-index",3); $("#Banner .pic li").eq(Banneri).animate({opacity: 1},300,function(){ $("#Banner .pic li").eq(Banneri).css("z-index",2); $("#Banner .pic li").each(function(i){ if(i != Banneri){ $("#Banner .pic li").eq(i).css("opacity",0); $("#Banner .pic li").eq(i).css("z-index",1); } }) }); }) $("#Banner .prev").click(function(){ Banneri--; if(Banneri<0){ Banneri=BannerTotal-1; }console.log(Banneri); $("#Banner .pic li").eq(Banneri).css("z-index",3); $("#Banner .pic li").eq(Banneri).animate({opacity: 1},300,function(){ $("#Banner .pic li").eq(Banneri).css("z-index",2); $("#Banner .pic li").each(function(i){ if(i != Banneri){ $("#Banner .pic li").eq(i).css("opacity",0); $("#Banner .pic li").eq(i).css("z-index",1); } }) }); }) }); function BannerAuto(){ var TemI = Banneri + 1; if(TemI > BannerTotal - 1) TemI = 0; BannerPicShow(TemI); BannerTime = setTimeout(BannerAuto,7000); } function BannerPicShow(i){ clearTimeout(BannerTime); $("#Banner .pic li").eq(Banneri).css("z-index",2); Banneri = i; $("#Banner .pic li").stop(); $("#Banner .btn li").removeClass("selected"); $("#Banner .btn li").eq(i).addClass("selected"); $("#Banner .pic li").eq(i).css("z-index",3); $("#Banner .pic li").eq(i).animate({opacity: 1},800,function(){ $("#Banner .pic li").eq(i).css("z-index",2); $("#Banner .pic li").each(function(i){ if(i != Banneri){ $("#Banner .pic li").eq(i).css("opacity",0); $("#Banner .pic li").eq(i).css("z-index",1); } }) }); }