Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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