var slidershow = $('#slide'), ul_1 = slidershow.find('.ul-1'), ul_2 = slidershow.find('.ul-2'), ul_3 = slidershow.find('.ul-3'), ul_4 = slidershow.find('.ul-4'), li_1_len = ul_1.find('li').length, nav = slidershow.find('.nav span'), onewidth = ul_1.find('li').eq(0).width(), arr_l = $("#slide .prev"), arr_r = $("#slide .next"), timer = null, ul_css = {'width':1920*li_1_len,'position':'absolute','left':0}, inow = 0; ul_1.css(ul_css); ul_2.css(ul_css); ul_3.css(ul_css); ul_4.css(ul_css); slidershow.hover(function(){ clearinterval(timer); arr_l.stop(false,true).animate({ left: 0}, { duration: 500 }); arr_r.stop(false,true).animate({ right: 0}, { duration: 500 }); },function () { arr_l.stop(false,true).animate({ left: -52}, { duration: 500 }); arr_r.stop(false,true).animate({ right: -52}, { duration: 500 }); autoplay() }); nav.mouseover(function(){ var me = $(this), index = me.index(); inow =index; imgslder(); nav.removeclass('active'); me.addclass('active'); }); function imgslder(){ var _left = {'left':-1920*inow}; ul_1.stop(false,true).animate(_left,1000,'easeinexpo'); ul_2.stop(false,true).animate(_left,1200,'easeinexpo'); ul_3.stop(false,true).animate(_left,900,'easeinexpo'); ul_4.stop(false,true).animate(_left,1400,'easeinexpo'); } function imgslde(){ nav.removeclass('active'); nav.eq(inow).addclass('active'); imgslder() } function autoplay(){ timer = setinterval(function(){ inow++; if(inow>nav.length-1){ inow=0; } //nav.eq(inow).trigger("mouseover"); imgslde() },5000); } autoplay() arr_l.click(function(){ if(inow < 1){ inow=nav.length; } inow = inow-1; //nav.eq(inow).trigger("mouseover"); imgslde() }) arr_r.click(function(){ inow = inow+1; if(inow>nav.length-1){ inow=0; } //nav.eq(inow).trigger("mouseover"); imgslde() })