Terrabythia
Terrabythia

Reputation: 2141

How to disable smooth scrolling in Chrome

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?

Upvotes: 5

Views: 9888

Answers (3)

Ben Mosher
Ben Mosher

Reputation: 13381

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

Upvotes: 2

Localist
Localist

Reputation: 1124

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

Set their "overflow" property to "hidden".

Upvotes: -1

Spencer
Spencer

Reputation: 979

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

Disable iOS Overscroll but allow body scrolling

Upvotes: 1

Related Questions