Created
December 18, 2014 09:01
-
-
Save tomlokhorst/413457d8956d01638993 to your computer and use it in GitHub Desktop.
Don't zoom in on Google Maps when scrolling through a website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fixMapScrollwheel(map) { | |
map.setOptions({ scrollwheel: false }); | |
google.maps.event.addListener(map, 'click', function() { | |
map.setOptions({ scrollwheel: true }); | |
}); | |
google.maps.event.addListener(map, 'mouseout', function() { | |
map.setOptions({ scrollwheel: false }); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could catch accidental map leaves:
(Written from the top of my head. Not tested.)