Last active
November 21, 2018 20:39
-
-
Save benoitryder/db1ed51ca0213b882806fad1f4540796 to your computer and use it in GitHub Desktop.
Change tabs with mousewheel in Firefox 57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
Did your try to run it in the Browser Toolbox?
I get the same error in Fx59. :( I put it in Browser Toolbox console.
TypeError: gBrowser.tabContainer.mTabstrip is undefined
works for me, thanks! is there a way to run this on startup?
@Keith94 The first revision of the gist doesn't use mTabstrip
. It might work with your version.
@fm3 Not that I know of. :(
The lastest version doesn't works with Firefox 58, but the first version works well.
Vote here to integrate this feature natively.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, I tried running your code but I get an error saying "gBrowser is not defined".
Any ideas?