如何调整JQuery动画幻灯片的速度?

How to adjust the speed in JQuery animation slide?

我有一张幻灯片转得很快,我需要帮助弄清楚如何放慢速度。任何帮助将不胜感激!

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

这是全部代码

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



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



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

看看jQuery animate 有 ja duration 参数。例如:

$(this).animate({'left':'-='+(n-c)+'px'}, 1000);

持续时间以毫秒为单位,默认设置为 400 毫秒。