jquery nicescroll

saomi picture saomi · Sep 18, 2012 · Viewed 29k times · Source

I'm using nicescroll plugin. http://areaaperta.com/nicescroll/

I have just a little doubt. When the page is loaded I can see my default scroll bar from the browser, and then the nicescroll bar it is showed. I want to apply the nicescroll bar to all the document and I have the following code

var nice = $("body").niceScroll({
        preservenativescrolling: false,
        cursorwidth: '8px',
        cursorborder: 'none',
        cursorborderradius:'0px',
        cursorcolor:"#39CCDB",
        autohidemode: false, 
        background:"#999999"
     });

If I set the autohidemode to true, I don't see the default scroll bar from the browser. But I want to make the nicescroll bar always visible.

Does anyone know why this is happening?? Thanks

Answer

user1979388 picture user1979388 · Jan 15, 2013

Maybe this might help you. It works for me.

<script id="twitter-wjs" src="../js/widgets.js"></script>
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.easing.1.3.js"></script>
<script src="../js/jquery.nicescroll.min.js"></script>


<script>

  // Hide Overflow of Body on DOM Ready //
$(document).ready(function(){
    $("body").css("overflow", "hidden");
});

// Show Overflow of Body when Everything has Loaded //
$(window).load(function(){
    $("body").css("overflow", "visible");        
    var nice=$('html').niceScroll({cursorborder:"",cursorcolor:"#333333",cursorwidth:"8px", boxzoom:true, autohidemode:false});

});
</script>