Created
June 13, 2016 07:59
-
-
Save s2ar/47c897b24b0fa5c4dd7b907ed35033ab to your computer and use it in GitHub Desktop.
Disable scroll google maps
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
// Disable scroll zooming and bind back the click event | |
var onMapMouseleaveHandler = function (event) { | |
var that = $(this); | |
that.on('click', onMapClickHandler); | |
that.off('mouseleave', onMapMouseleaveHandler); | |
//that.find('iframe').css("pointer-events", "none"); | |
that.find('#map-wrapper').css("pointer-events", "none"); | |
} | |
var onMapClickHandler = function (event) { | |
var that = $(this); | |
// Disable the click handler until the user leaves the map area | |
that.off('click', onMapClickHandler); | |
// Enable scrolling zoom | |
//that.find('iframe').css("pointer-events", "auto"); | |
that.find('#map-wrapper').css("pointer-events", "auto"); | |
// Handle the mouse leave event | |
that.on('mouseleave', onMapMouseleaveHandler); | |
} | |
// Enable map zooming with mouse scroll when the user clicks the map | |
$(document).on('click','#js-map-box', onMapClickHandler); | |
//$('.maps.embed-container').on('click', onMapClickHandler); | |
// Загрузка карты с параметром scrollwheel: false | |
// B js карты добавитьт | |
map.addListener('click', function() { | |
map.set('scrollwheel', true); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment