I am using a Mac Trackpad on a Google Map. If I two-finger swipe down or up, the map zooms in or out (like it should), but then the entire page scrolls up or down.
I think it has to do with the Trackpad momentum (probably the same on a Magic Mouse).
When I use a normal mouse with a scroll wheel, I don't have the same problem.
I have tried doing things like e.preventDefault()
in the scroll
listener of the map element, but no luck.
To see an example, just zoom in or out really fast on Google's own demo page: https://developers.google.com/maps/documentation/javascript/examples/map-simple
How do I prevent the entire page from scrolling when I am only trying to zoom the map?
Thank you!