Skip to content

Instantly share code, notes, and snippets.

@lilumi
Created October 28, 2015 11:13
Show Gist options
  • Save lilumi/9f158b547e3baf6ecc39 to your computer and use it in GitHub Desktop.
Save lilumi/9f158b547e3baf6ecc39 to your computer and use it in GitHub Desktop.
// Just set the pointer-events: none CSS to the <iframe> to disable mouse scroll.
/*
<div id="gmap-holder">
<iframe width="100%" height="400" frameborder="0" style="border:0; pointer-events:none"
src="https://www.google.com/maps/embed/v1/place?q=XXX&key=YYY"></iframe>
</div>
If you want the mouse scroll to be activated when the user clicks into the map, then use the following JS code.
It will also disable the mouse scroll again, when the mouse moves out of the map.
*/
$('#gmap-holder').click(function(e) {
$(this).find('iframe').css('pointer-events', 'all');
}).mouseleave(function(e) {
$(this).find('iframe').css('pointer-events', 'none');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment