var lunbo={ timer:0, index:-1, size:1 } lunbo.size=$('.slider .slideritem').length; function mychange(){ clearInterval(lunbo.timer); lunbo.index++; if(lunbo.index<0){ lunbo.index=lunbo.size-1; } else if(lunbo.index==lunbo.size){ lunbo.index=0; } var ilenth=parseInt($('.slider .slideritem').css('width')); var ileft=ilenth*lunbo.index; $('.navpoint li').eq(lunbo.index).addClass('cur'); $('.navpoint li').eq(lunbo.index).siblings().removeClass('cur'); $('.textul li').eq(lunbo.index).addClass('cur'); $('.textul li').eq(lunbo.index).siblings().removeClass('cur'); $('.slider').stop(true,false).animate({'left':-ileft},250,function(){ lunbo.timer=setInterval(function(){mychange();},4500); }) } $('.navpoint li').mouseover(function(){ clearInterval(lunbo.timer); lunbo.index=$(this).index()-1; mychange(); }) $('.slideritem').mouseover(function(){ clearInterval(lunbo.timer); lunbo.index--; }) $('.slideritem').mouseout(function(){ mychange(); }) $('.textul li').mouseover(function(){ clearInterval(lunbo.timer); lunbo.index--; }) $('.textul li').mouseout(function(){ mychange(); }) mychange(); $(window,document).scroll(function(){ if($(window,document).scrollTop()>80){ $('.back_top').show(); }else{ $('.back_top').hide(); } })