Disable Chrome two fingers back/forward swipe
Asked Answered
H

5

23

I have a page where the user can scroll horizontally the content, and in Chrome this scroll action sometimes triggers the two fingers back/forward swipe.

How can I deactivate this Chrome's function in a specific page, without disabling horizontal scroll?

Hyden answered 4/7, 2013 at 16:34 Comment(4)
It doesn't look like it's possible to change it as a developer; only as a user. See How do I disable Chrome's two-finger back/forward navigation? and productforums.google.com/forum/#!topic/chrome/PaMriZC-KuoRespectable
Check my answer/example here (it may help): #15829672Gran
Check my answer/example here (it may help): #15829672Gran
Does this answer your question? Stop chrome back/forward two finger swipeParlando
S
39

After way too long, I discovered this:

html, body {
  overscroll-behavior-x: none;
}
Stator answered 13/6, 2018 at 22:4 Comment(3)
@MattSanders you probably need to set it on another DOM element. For me it works using the same Chrome version.Courier
@Courier - hmm, thanks. Is it working for you on body or a different element?Aerify
In case this helps someone else, body and the element with overflow on it didn't work, but putting overscroll-behavior-x on the html element itself did work for me.Aerify
C
5

I have found that this chrome setting disabled the behavior: chrome://flags/#overscroll-history-navigation

Just disable overscroll, it will disable the page navigation using the scroll but normal horizontal scroll on the page will work. Tested on my end.

Connected answered 10/8, 2016 at 4:9 Comment(2)
It seems that this no longer exists?Unpractical
This still exists in Edge (chrome-based)Cassella
D
3

Go to Chrome flags by pasting Chrome://flags in the address bar and search for Overscroll history navigation and change this from default to Disabled

It will prompt to restart the browser, restart it.

This should solve it.

Darr answered 7/5, 2020 at 8:12 Comment(1)
Finally I got rid of that nasty feature. Thanks!Figment
S
2

It is only possible to disable this feature by disabling scrolling itself:

With jQuery:

('body').on('wheel', function(e){ e.preventDefault(); });

Without jQuery:

document.body.addEventListener('wheel', function(e){ e.preventDefault(); });

This code will work in Modern browsers but is not cross-browser tested. Also, MAJOR CAVEAT: if you still want the users to be able to scroll the page, you'll have to roll your own scrolling to make it all work.

Sybyl answered 11/12, 2015 at 19:17 Comment(0)
M
2

Posting a non-CSS answer, which sometimes you don't have access to.

Run chromium / chrome with the disable-features=OverscrollHistoryNavigation :

# Run Chromium or Chrome with following flag
chromium --disable-features=OverscrollHistoryNavigation

Other gesture-related flags are usually recommended (such as the one that disables zooming via pinch, --disable-pinch), can be found here: https://niek.github.io/chrome-features/, which is a blog post recommended on the official docs (here, down bottom)

Mite answered 15/11, 2023 at 13:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.