Skip to content

Instantly share code, notes, and snippets.

@acdha
Created February 21, 2014 20:55
Show Gist options
  • Save acdha/9143318 to your computer and use it in GitHub Desktop.
Save acdha/9143318 to your computer and use it in GitHub Desktop.
Prevent LeafletJS from halting a page scroll if the map passes under the pointer by disabling scroll/touch zooming until the user has clicked on the map
(function () {
ItemMap.scrollWheelZoom.disable();
ItemMap.touchZoom.disable();
var enableMapInteraction = function () {
map.scrollWheelZoom.enable();
map.touchZoom.enable();
}
$('#item-map').on('click touch', enableMapInteraction);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment