$("document").ready(function(){ /***不需要自动滚动,去掉即可***/ arrow($('.htmlcase1,.htmlcase2'),$('.htmlcase1'),$('.htmlcase2'),$('.casepiculidbox'),$('.casepiculidbox li'),$('.caseleft'),$('.caseright')); //arrow($('.htmlcaset1,.htmlcaset2'),$('.htmlcaset1'),$('.htmlcaset2'),$('.casepiculidboxtitle'),$('.casepiculidboxtitle li'),$('.caseleft'),$('.caseright')); function arrow(a,b,c,d,e,f,g){ // var $htmlpica1_htmlpica2= $('.htmlpica1,.htmlpica2'); // var $htmlpica1= $('.htmlpica1'); // var $htmlpica2= $('.htmlpica2'); // var $casepiculidbox= $('.casepiculidbox'); // var $casepiculidbox_ul= $('.casepiculidbox ul'); // var $caseleft = $('.caseleft'); // var $caseright = $('.caseright'); var $htmlpica1_htmlpica2= a; var $htmlpica1= b; var $htmlpica2= c; var $casepiculidbox= d; var $casepiculidbox_ul= e; var $caseleft = f; var $caseright = g; var timea = window.setinterval(function(){ $caseright.click(); },5000); $casepiculidbox.mouseover(function() { clearinterval(timea); }); $casepiculidbox.mouseout(function(){ timea = window.setinterval(function(){ $caseright.click(); },5000); }); $caseleft.mouseover(function() { clearinterval(timea); }); $caseleft.mouseout(function(){ timea = window.setinterval(function(){ $caseleft.click(); },5000); }); $caseright.mouseover(function() { clearinterval(timea); }); $caseright.mouseout(function(){ timea = window.setinterval(function(){ $caseright.click(); },5000); }); /***不需要自动滚动,去掉即可***/ var ha = $casepiculidbox_ul.width(); //alert(ha); var pagetotala= $casepiculidbox_ul.length; var wa = pagetotala*ha; $casepiculidbox.css("width",pagetotala*ha+"px"); $htmlpica2.html($htmlpica1.html());//复制内容; $('.casepiculidboxtitle').css("width",pagetotala*ha+"px"); $(".htmlcaset2").html($(".htmlcaset1").html());//复制内容; $caseleft.bind('click',upwardsfna); $caseright.bind('click',downfna); function upwardsfna(){ if($htmlpica1_htmlpica2.is(':animated')){ $htmlpica1_htmlpica2.stop(true,true); } if($casepiculidbox_ul.length>1){ mla = parseint($htmlpica1.css('left')); sla = parseint($htmlpica2.css('left')); $(".htmlcaset1").css('left',mla); $(".htmlcaset2").css('left',sla); if(mla<=0 && mla>wa*-1){ $htmlpica2.css({left: wa * -1 + 'px'}); $htmlpica1.animate({left: mla + 226 + 'px'},'slow'); $(".htmlcaset2").css({left: wa * -1 + 'px'}); $(".htmlcaset1").animate({left: mla + 226 + 'px'},'slow'); if(mla==0){ $htmlpica2.animate({left: (wa - 226) * -1 + 'px'},'slow'); $(".htmlcaset2").animate({left: (wa - 226) * -1 + 'px'},'slow'); } }else{ $htmlpica1.css({left: wa * -1 + 'px'}); $htmlpica2.animate({left: sla + 226 + 'px'},'slow'); $(".htmlcaset1").css({left: wa * -1 + 'px'}); $(".htmlcaset2").animate({left: sla + 226 + 'px'},'slow'); if(sla==0){ $htmlpica1.animate({left: mla + 226 + 'px'},'slow'); $(".htmlcaset1").animate({left: mla + 226 + 'px'},'slow'); } } } } function downfna(){ if($htmlpica1_htmlpica2.is(':animated')){ $htmlpica1_htmlpica2.stop(true,true); } if($casepiculidbox_ul.length>1){//多于4张图片 mla = parseint($htmlpica1.css('left'));//默认图片ul位置 sla = parseint($htmlpica2.css('left'));//交换图片ul位置 $(".htmlcaset1").css({'left':mla }); $(".htmlcaset2").css({'left': sla}); if(mla<=0 && mla>wa*-1){//默认图片显示时 $htmlpica2.css({left: '226px'});//交换图片放在显示区域右侧 $htmlpica1.animate({left: mla - 226 + 'px'},'slow');//默认图片滚动 $(".htmlcaset2").css({left: '226px'});//交换图片放在显示区域右侧 $(".htmlcaset1").animate({left: mla - 226 + 'px'},'slow');//默认图片滚动 if(mla==(wa-226)*-1){//默认图片最后一屏时 $htmlpica2.animate({left: '0px'},'slow');//交换图片滚动 $(".htmlcaset2").animate({left: '0px'},'slow');//交换图片滚动 } }else{//交换图片显示时 $htmlpica1.css({left: '226px'})//默认图片放在显示区域右 $htmlpica2.animate({left: sla - 226 + 'px'},'slow');//交换图片滚动 $(".htmlcaset1").css({left: '226px'})//默认图片放在显示区域右 $(".htmlcaset2").animate({left: sla - 226 + 'px'},'slow');//交换图片滚动 if(sla==(wa-226)*-1){//交换图片最后一屏时 $htmlpica1.animate({left: '0px'},'slow');//默认图片滚动 $(".htmlcaset1").animate({left: '0px'},'slow');//默认图片滚动 } } } } } });