【问题标题】:?Chrome on Windows 10 and mousewheel: smoothscroll enabled results in ~1.25 change per wheel click?Windows 10 上的 Chrome 和鼠标滚轮:启用平滑滚动会导致每次滚轮单击更改约 1.25
【发布时间】:2017-08-20 05:26:06
【问题描述】:

我正在尝试查找在 Windows 10 上使用 chrome 滚动鼠标滚轮的问题。在一个页面上,如果启用平滑滚动,则鼠标滚轮的每个刻度只会导致滚动变化约 1.25 像素,并且不会即使您在很短的时间内大幅移动车轮,也不会走得很快。

如果禁用平滑滚动(通过 chrome://flags),每个刻度大约为 125 像素。

我无法在 chrome 源中找到基于平滑滚动设置确定 delta 的位置,我想知道其他人是否知道它在哪里,并且可能对 chrome 的确切含义有所了解基于平滑滚动设置进行。

真的很奇怪。

谢谢!

【问题讨论】:

    标签: google-chrome windows-10


    【解决方案1】:

    Ben Mosher 在How to disable smooth scrolling in Chrome 上发布的答案。他的回答中的 sn-p 是这样的:

    function wheeled(event) {
      event.preventDefault()
    
      container.scrollTop += event.deltaY
      container.scrollLeft += event.deltaX
    }
    
    container.addEventListener('wheel', wheeled, { passive: false, capture: true })
    // actual render code is in the `scrolled` handler because
    // there are other wheel events in the code that adjust the scroll position
    container.addEventListener('scroll', scrolled, { passive: true })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-01
      • 1970-01-01
      • 2015-02-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多