Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何降低jquery滚动速度以避免动画闪烁_Jquery_Scrollto - Fatal编程技术网

如何降低jquery滚动速度以避免动画闪烁

如何降低jquery滚动速度以避免动画闪烁,jquery,scrollto,Jquery,Scrollto,我目前正在使用以下代码,但我需要将其速度减慢,以避免动画闪烁。该网站发布于dotmobi $('#nav a, #top-nav a, #bottom-nav a').click(function(e){ var my_offset = $(this.hash).offset().top; $('body').scrollTo(this.hash, {duration:'slow'}); //$('html, body').scrollTo(this.hash, th

我目前正在使用以下代码,但我需要将其速度减慢,以避免动画闪烁。该网站发布于dotmobi

 $('#nav a, #top-nav a, #bottom-nav a').click(function(e){
    var my_offset = $(this.hash).offset().top;

    $('body').scrollTo(this.hash, {duration:'slow'});
    //$('html, body').scrollTo(this.hash, this.hash);

    return false;
  });
试一试


不要说慢,而是以毫秒(1000=1秒)为单位输入值。 例如


如果您的浏览器闪烁,则表示您没有功能强大的浏览器或系统资源不足。而是使用hide()和show()而不是动画。如果要隐藏,请在一两秒钟后隐藏以避免闪烁。

谢谢,动画闪烁只发生在iPad上。注意:如果您选择使用jQuery animate,请从Greensock()查看TweenMax(例如速度和功率,查看英特尔主页),速度会快得多!
$('html, body').animate({
        scrollTop: my_offset 
}, 2000); // 2000ms  = 2s duration
$('#nav a, #top-nav a, #bottom-nav a').click(function(e){
var my_offset = $(this.hash).offset().top;

$('body').scrollTo(this.hash, {duration:'2000'});
//$('html, body').scrollTo(this.hash, this.hash);

return false;
   });