【问题标题】:JQuery animate({scrolltop: top}, 800) is not smooth in chromeJQuery animate({scrolltop: top}, 800) 在 chrome 中不流畅
【发布时间】:2023-02-09 13:05:27
【问题描述】:

我正在尝试在我网站的部分之间使用平滑滚动。

我也尝试通过从控制台运行 $('html,body').animate({ scrollTop: 2000 }, 800); 来手动滚动。

在 firefox 上一切正常,但在 chrome 和 edge 上却不流畅。它开始时会很慢,好像要花一整分钟才能到达正确的部分。然后就在它应该完成之前(~800 毫秒)它会跳得更快。它仍然会去正确的地方。

还有其他人遇到过这个问题吗?

【问题讨论】:

    标签: jquery google-chrome scroll jquery-animate smoothing


    【解决方案1】:

    刚刚找到了from another question提供的答案。但这对我不起作用,因为我希望用户能够根据需要滚动。这是我正在使用的 css 工作:

    html { overflow-x: hidden; overflow-y: hidden; height: 100%; }
    body { overflow-y: scroll; height: 100%;}
    

    我只是强制滚动正文而不是 html。我不确定为什么 chrome 和 edge 没有这个就坏了,这可能与我正在使用的扩展或我没有意识到我正在使用的平滑滚动设置有关。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-29
      • 1970-01-01
      • 1970-01-01
      • 2021-12-27
      • 1970-01-01
      • 2011-11-19
      相关资源
      最近更新 更多