If you're browsing with an embedded maps iframe using your trackpad or mouse, you can potentially trap yourself into the Maps' zooming capabilities, which is really annoying.
Try it here: https://developers.google.com/maps/documentation/embed/guide#overview
Is there a way to prevent this?
Google Maps Integration using simple Iframe code embed from Google. One of the best ways to integrate Maps into your site is with an Iframe code. It's the simplest way, especially if you aren't too clued up on website building.
Install ScrollMaps and you can use two-finger scroll in Google Maps™. Now works in the redesigned Google Maps™ too. It's designed for Mac trackpads but because of the simple mechanism, it should work on all trackpads, or even a Magic Mouse. To zoom in the maps, simply use the pinch gesture.
This has been answered here => Disable mouse scroll wheel zoom on embedded Google Maps by Bogdan. What it does is that it will disable the mouse until you click onto the map and the mouse start working again, if you move the mouse out from the map the mouse will be disabled again.
Note: Does not work on IE < 11 (Working fine on IE 11)
CSS:
<style> .scrolloff { pointer-events: none; } </style>
Script:
<script> $(document).ready(function () { // you want to enable the pointer events only on click; $('#map_canvas1').addClass('scrolloff'); // set the pointer events to none on doc ready $('#canvas1').on('click', function () { $('#map_canvas1').removeClass('scrolloff'); // set the pointer events true on click }); // you want to disable pointer events when the mouse leave the canvas area; $("#map_canvas1").mouseleave(function () { $('#map_canvas1').addClass('scrolloff'); // set the pointer events to none when mouse leaves the map area }); }); </script>
HTML: (just need to put correct id as defined in css and script)
<section id="canvas1" class="map"> <iframe id="map_canvas1" src="https://www.google.com/maps/embe...." width="1170" height="400" frameborder="0" style="border: 0"></iframe> </section>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With