scroll - How do I prevent the page from scrolling when I zoom on a Google Map in Chrome? -


i using mac trackpad on google map. if two-finger swipe down or up, map zooms in or out (like should), entire page scrolls or down.

i think has trackpad momentum (probably same on magic mouse).

when use normal mouse scroll wheel, don't have same problem.

i have tried doing things e.preventdefault() in scroll listener of map element, no luck.

to see example, zoom in or out fast on google's own demo page: https://developers.google.com/maps/documentation/javascript/examples/map-simple

how prevent entire page scrolling when trying zoom map?

thank you!

with jquery try this:

 $("#idofmap").on("wheel mousewheel dommousescroll", function(e){      e.preventdefault();  }); 

when using jquery prior 1.7 use bind() instead of on().


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -