最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to disable smooth scrolling in Chrome - Stack Overflow

programmeradmin4浏览0评论

I'm creating a web app (that's mostly focused on usage in Chrome), but the 'smooth scrolling' (I guess that's what it's called, the 'extra' scrolling like on IOS) of Chrome (when on mac) gets in the way.

Is there any way to disable this via javascript?

I'm creating a web app (that's mostly focused on usage in Chrome), but the 'smooth scrolling' (I guess that's what it's called, the 'extra' scrolling like on IOS) of Chrome (when on mac) gets in the way.

Is there any way to disable this via javascript?

Share Improve this question edited Jan 19, 2013 at 22:53 cwiggo 2,6099 gold badges48 silver badges91 bronze badges asked Oct 5, 2012 at 13:51 TerrabythiaTerrabythia 2,1813 gold badges22 silver badges30 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 2

I was able to mitigate some rendering issues I was having with smooth scrolling by intercepting wheel events and moving the scrollTop/scrollLeft pixel positions "by hand":

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 })

What you're referring to as smooth scrolling is called overscroll bounce or rubber-band scrolling.

Disable iOS Overscroll but allow body scrolling

Use Javascript to set the CSS style of the HTML and BODY tags.

Set their "overflow" property to "hidden".

发布评论

评论列表(0)

  1. 暂无评论