Skip to content

Instantly share code, notes, and snippets.

@janzenz
Last active July 6, 2016 19:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janzenz/29b4b6c84e478a47732cafb3e2d871cd to your computer and use it in GitHub Desktop.
Save janzenz/29b4b6c84e478a47732cafb3e2d871cd to your computer and use it in GitHub Desktop.
Google Maps Zoom disable
var googleMaps = document.querySelectorAll(".google-maps-container");
for (var i = 0; i < googleMaps.length; i++) {
googleMaps[i].onclick = function(e) {
e.target.getElementsByTagName("iframe")[0].style["pointer-events"] = 'auto';
};
googleMaps[i].onmouseout = function(e) {
e.target.getElementsByTagName("iframe")[0].style["pointer-events"] = 'none';
}
}
<html>
<body>
<div class='google-maps-container'>
<iframe src='https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d387144.0075834208!2d-73.97800349999999!3d40.7056308!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c24fa5d33f083b%3A0xc80b8f06e177fe62!2sNew+York%2C+NY!5e0!3m2!1sen!2sus!4v1394298866288'
width='600' height='450' frameborder='0' style='border:0'></iframe>
</div>
</body>
</html>
.google-maps-container iframe {
pointer-events: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment