jQuery ScrollTo:link=funky movement stacking上的多次单击

jQuery ScrollTo:link=funky movement stacking上的多次单击,jquery,scrollto,Jquery,Scrollto,代码如下: $('.next').click(function(){ $(window).stop(true,true).scrollTo('+=800px', 1000, { axis:'x' } ); }); $('.prev').click(function(){ $(window).stop(true,true).scrollTo('-=800px', 1000, { axis:'x' } ); }); 可在此预览网站: 当多次单击»时,即使使用st

代码如下:

$('.next').click(function(){
        $(window).stop(true,true).scrollTo('+=800px', 1000, { axis:'x' } );
 });
$('.prev').click(function(){
        $(window).stop(true,true).scrollTo('-=800px', 1000, { axis:'x' } );
 });
可在此预览网站:

当多次单击»时,即使使用
stop(true,true)
参数,它也会将它们排队。有人知道为什么吗?

只会影响该元素的动画队列,而在这种情况下,您可以(不需要此处的
滚动到
插件):


这样会影响这些元素上的动画队列。

哦,哇,我从来不知道你可以
animate()
滚动。。。那很方便。在本例中,我去掉了“true,true”参数,因为它不会在设置动画时忽略第二次单击,而是会自动向前跳到下一个位置并从那里开始滚动。我刚做了一个
stop()
,效果非常好。非常感谢。
$('.next').click(function(){
  $("html, body").stop(true,true).animate({ scrollLeft: '+=800' }, 1000);
});
$('.prev').click(function(){
  $("html, body").stop(true,true).animate({ scrollLeft: '-=800' }, 1000);
});