Force visible scrollbar in Firefox on Mac OS X
Asked Answered
G

4

50

Firefox 24 introduced Lion scrollbar support. This will show scrollbars in Lion style on Mac OS X. See: https://wiki.mozilla.org/Lion_Scrollbars/Triage

This causes a problem for me: a scrollbar on a div is now hidden by default. Sometimes I want to force a visible scrollbar.

For WebKit there is a nice solution (mentioned at https://davidwalsh.name/osx-overflow):

::-webkit-scrollbar {
   -webkit-appearance: none;
   width: 7px;
}

::-webkit-scrollbar-thumb {
   border-radius: 4px;
   background-color: rgba(0,0,0,.5);
   -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}

Does anybody know how I can force a visible scrollbar in Firefox 24 (and up) on Mac OS X?

Are there any drop-in javascript scrollbars that match webkit scrollbars?

Grugru answered 19/8, 2013 at 15:33 Comment(4)
Unfortunately, this is currently not possible in FF. See: bugzilla.mozilla.org/show_bug.cgi?id=77790 The workaround would be to use javascript scrollbars that reimplement native behavior. Keep in mind that browsers are respecting the user preferences set in OSX and users are already trained to scroll in areas that appear to have overflow.Sports
One thing to be careful of is to design your page in such a way that it actually does appear to have overflow whenever it does. I see many sites now that use "stacked screens" as a design, where you scroll down and keep seeing different screens or "pages" - but if you don't notice the short scrollbar, and the "fold" happens to be right above the start of the next screen, there is nothing to indicate that more content exists. Take frontporch.io for example (as of 10/14/2013.)Bounteous
What is the question here? Do you want to force the visibility of scrollbars? Or do you want to customize the look of the scrollbars?Chigetai
doesn't the webkit work in firefoxBarajas
H
29

As user thirtydot explained in another question, there is no way to customize scrollbars in Firefox as its possible in Chrome.

Also, there is no way to actually "force" Firefox render the old-style scrollbar since the default scrollbar used in the system is predefined by the OS itself (note that you can modify which scrollbar you want in System Preferences).

In other words, until Firefox supports native custom scrollbars, it is only possible with JavaScript plugins such as jScrollPane and similar.

Hispaniola answered 19/8, 2013 at 16:6 Comment(0)
S
4

Here's a solution but you have to use Javascript. Basically it runs a loop that forces the browser to show the scrollbars.

Use this CSS to make sure your div is set to show scrollbars:

.mydiv{ overflow-y:auto; }

Then attach this script to your page (this requires JQuery).

<script type="text/JavaScript">
var sc;
jQuery(document).ready(function(){
    //constantly update the scroll position:
    sc=setInterval(scrollDown,200);

    //optional:stop the updating if it gets a click
    jQuery('.mydiv').mousedown(function(e){
        clearInterval(sc);            
    });
});
function scrollDown(){
    //find every div with class "mydiv" and apply the fix
    for(i=0;i<=jQuery('.mydiv').length;i++){
        try{
            var g=jQuery('.mydiv')[i];
            g.scrollTop+=1;
            g.scrollTop-=1;
        } catch(e){
            //eliminates errors when no scroll is needed
        }
    }
}
</script>
Spidery answered 3/3, 2015 at 15:46 Comment(3)
Unfortunately I can't get your solution to work. No visible scrollbar by default in Firefox on my Mac. I created a jsfiddle with your solution: jsfiddle.net/o92gdd9y What am I doing wrong?Grugru
It does work, but the script was assuming vertical scroll. Your div is assuming horizontal scroll. So you need to constantly update scrollLeft like so: jsfiddle.net/o92gdd9y/2 (which works, but it's a hack)Reichsmark
This approach begs for trouble. You would have to handle all native gestures (including future ones) that trigger scroll (including mousewheel), and strange side-effects like flickering might show and confuse the user.Perionychium
S
-1

How about overflow: -moz-scrollbars-vertical?

Solidify answered 28/9, 2016 at 7:49 Comment(1)
And why would this work over anything else? Generally answering a question with another question is not good form. If you know this works, make it a real answer by explaining how it helps. If you don't know this works, wait until you have enough rep to comment, then comment.Numismatics
S
-2

The actual answer for this is go to System Preferences - General Tab - and turn 'Show Scroll Bars' to 'Always'.

Sorb answered 9/8, 2021 at 23:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.