Skip to content

Instantly share code, notes, and snippets.

@fm3
Forked from benoitryder/ff57-tabs-mousewheel.js
Last active June 13, 2018 07:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fm3/fcb0d002a3a3d88a771ddb80ffbc01e7 to your computer and use it in GitHub Desktop.
Save fm3/fcb0d002a3a3d88a771ddb80ffbc01e7 to your computer and use it in GitHub Desktop.
Change tabs with mousewheel in Firefox 58
/* To enable changing tabs by using the mouse wheel,
* enter this code into the browser console (Ctrl+Shift+J) */
var onTabWheel = function(ev) {
if (ev.deltaMode == 1 /* DOM_DELTA_LINE */) {
var idx = gBrowser.tabContainer.getIndexOfItem(gBrowser.selectedTab);
var direction = ev.deltaY > 0 ? 1 : -1;
gBrowser.selectTabAtIndex((idx + direction) % gBrowser.tabs.length);
}
}
gBrowser.tabContainer.arrowScrollbox.addEventListener("wheel", onTabWheel);
@fm3
Copy link
Author

fm3 commented Jan 27, 2018

updated for Firefox 58, using renamed field arrowScrollbox

@muesli
Copy link

muesli commented Apr 4, 2018

Thanks, what a lifesaver! Could this be wrapped as a simple Firefox extension, by chance?

@fm3
Copy link
Author

fm3 commented Apr 19, 2018

@muesli if you find out how, let me know! There are some discussions about that general feature here and here

@fm3
Copy link
Author

fm3 commented Jun 13, 2018

@muesli someone in the manjaro forums figured out a way to enable this on startup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment