2016-04-11 10 views
0

私は速く進んでいるスライドを持っており、私はそれを遅らせる方法を理解するのに役立つ必要があります。どんな助けでも大歓迎です!JQueryアニメーションスライドの速度を調整する方法は?

[http://catchieconcepts.com/][1]

これは、すべてのコード

jQuery(document).ready(function($){ 
 
\t var w,mHeight,tests=$("#testimonials"); 
 
\t w=tests.outerWidth(); 
 
\t mHeight=0; 
 
\t tests.find(".testimonial").each(function(index){ 
 
\t \t $("#t_pagers").find(".pager:eq(0)").addClass("active"); \t //make the first pager active initially 
 
\t \t if(index==0) 
 
\t \t \t $(this).addClass("active"); \t //make the first slide active initially 
 
\t \t if($(this).height()>mHeight) \t //just finding the max height of the slides 
 
\t \t \t mHeight=$(this).height(); 
 
\t \t var l=index*w; \t \t \t \t //find the left position of each slide 
 
\t \t $(this).css("left",l); \t \t \t //set the left position 
 
\t \t tests.find("#test_container").height(mHeight); \t //make the height of the slider equal to the max height of the slides 
 
\t }); 
 
}); 
 

 

 

 
$(".pager").on("click",function(e){ \t //clicking action for pagination 
 
e.preventDefault(); 
 
next=$(this).index(".pager"); 
 
clearInterval(t_int); \t //clicking stops the autoplay we will define later 
 
moveIt(next); 
 
}); 
 

 

 

 
function moveIt(next){ \t //the main sliding function 
 
\t var c=parseInt($(".testimonial.active").removeClass("active").css("left")); \t //current position 
 
\t var n=parseInt($(".testimonial").eq(next).addClass("active").css("left")); \t //new position 
 
\t $(".testimonial").each(function(){ \t //shift each slide 
 
\t \t if(n>c) 
 
\t \t \t $(this).animate({'left':'-='+(n-c)+'px'}); 
 
\t \t else 
 
\t \t \t $(this).animate({'left':'+='+Math.abs(n-c)+'px'}); 
 
\t }); 
 
\t $(".pager.active").removeClass("active"); \t //very basic 
 
\t $("#t_pagers").find(".pager").eq(next).addClass("active"); \t //very basic 
 
}

答えて

2

jQuery animate を見JA durationパラメータがあります。例:

期間はミリ秒で、デフォルトは400msに設定されています。

+0

ありがとうございました!これにより、あるスライドから次のスライドへの移行速度が遅くなりました。 – Alexis

関連する問題