Skip to content

Instantly share code, notes, and snippets.

@snippins
Forked from benoitryder/ff57-tabs-mousewheel.js
Created March 4, 2018 18:18
Show Gist options
  • Save snippins/d2822c27aca0f42dee06b08d6933f40d to your computer and use it in GitHub Desktop.
Save snippins/d2822c27aca0f42dee06b08d6933f40d to your computer and use it in GitHub Desktop.
Change tabs with mousewheel in Firefox 57
// Change tabs with mousewheel
// Run into Browser Toolbox console
var onTabWheel = function(ev) {
if (ev.deltaMode == 1 /* DOM_DELTA_LINE */) {
var idx = gBrowser.tabContainer.getIndexOfItem(gBrowser.selectedTab);
if (ev.deltaY > 0) {
if (idx + 1 < gBrowser.tabs.length) {
gBrowser.selectTabAtIndex(idx + 1);
}
} else if (ev.deltaY < 0) {
if (idx > 0) {
gBrowser.selectTabAtIndex(idx - 1);
}
}
}
}
gBrowser.tabContainer.mTabstrip._scrollbox.addEventListener("wheel", onTabWheel);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment