Skip to content

Instantly share code, notes, and snippets.

@henrik
Created July 3, 2011 22:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrik/1062679 to your computer and use it in GitHub Desktop.
Save henrik/1062679 to your computer and use it in GitHub Desktop.
Userscript to disable Google Maps scroll zoom in Google Chrome.
// ==UserScript==
// @name Disable Google Maps scroll zoom in Google Chrome
// @namespace http://henrik.nyh.se
// @description Disables Google Maps scroll zoom because it's unusable with Apple's Magic Mouse. Confirmed to work in Google Chrome.
// @include http://maps.google.com/*
// ==/UserScript==
// Adapted from the Safari extension by Mario Tausch/Tiago Rodrigues (https://public.me.com/ix/mariotausch/dev/index.html)
// via http://www.leancrew.com/all-this/2011/05/the-google-maps-scrollzoom-confusion/.
var noop = function(e) {
e.preventDefault();
e.stopPropagation();
return false;
};
var children = document.getElementById("map").childNodes;
for (var i=0, l=children.length; i<l; i++) {
children[i].addEventListener("mousewheel", noop, false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment