Skip to content

Instantly share code, notes, and snippets.

@s2ar
Created June 13, 2016 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s2ar/47c897b24b0fa5c4dd7b907ed35033ab to your computer and use it in GitHub Desktop.
Save s2ar/47c897b24b0fa5c4dd7b907ed35033ab to your computer and use it in GitHub Desktop.
Disable scroll google maps
// 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