Skip to content

Instantly share code, notes, and snippets.

@jackm
Created July 19, 2017 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackm/45e523c8d544d2d8dd9d506ab5177a57 to your computer and use it in GitHub Desktop.
Save jackm/45e523c8d544d2d8dd9d506ab5177a57 to your computer and use it in GitHub Desktop.
Disable auto scrolling userscript
// ==UserScript==
// @name Disable auto scrolling
// @version 1.0
// @description Disables auto scrolling on pages (ie. middle mouse scrolling)
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var target;
window.addEventListener('mousedown', function(mouseEvent) {
if(mouseEvent.button != 1)
return;
target = mouseEvent.target;
mouseEvent.preventDefault();
mouseEvent.stopPropegation();
}, true);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment