Skip to content

Instantly share code, notes, and snippets.

@paulrouget
Created November 2, 2012 17:59
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save paulrouget/4003205 to your computer and use it in GitHub Desktop.
Save paulrouget/4003205 to your computer and use it in GitHub Desktop.
Floating scrollbars in Firefox
/**
* How to have floating scrollbars in Firefox (Linux, Windows & Mac).
* Screenshot: http://i.imgur.com/bn44L.png
* You need Firefox > 18. Just run this code in a browser-scratchpad:
*
* Ping me on Twitter (@paulrouget) if you run into problems.
*
* 1. Go to about:config - Set devtools.chrome.enabled to true
* 2. Starts Scratchpad (Shift-F4)
* 3. In Scratchpad's menubar, check "Environment > Browser"
* 4. Past this whole code
* 5. In Scratchpad's menubar, click "Execute > Run"
*
* If you restart Firefox, you'll need to re-do these steps.
* You will find bugs.
* The scrollbars style is very basic (grey, doesn't fade out).
* For osx, we are working on an actual fix (see bug 636564).
*
* Someone should build an addon.
*
*/
let sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
let url = Services.io.newURI("chrome://browser/skin/devtools/floating-scrollbars.css", null, null);
sss.loadAndRegisterSheet(url, 0);
let root = document.documentElement;
let display = root.style.display;
root.style.display = "none";
window.getComputedStyle(root).display; // Flush
root.style.display = display; // Restore
@heftig
Copy link

heftig commented Nov 3, 2012

The clickable area doesn't touch the window border, so it's not possible to scroll a fullscreen window by clicking at the screen edge. A bit of an usability problem. Seems to work fine otherwise. (FF18, Linux)

@nightson
Copy link

nightson commented Nov 3, 2012

This will break the layout of dropdown menu of awesome bar

@Ajnasz
Copy link

Ajnasz commented Nov 4, 2012

It's invisible if the website has a black background.

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