niceScroll doesn’t play nice

Whilst working on a Pimcore site, I had this irritating problem with my wysiwig editors, in that if you pressed space, instead of typing a space, it scrolled the page. I knew it must be some javascript library or other included in my template, and it turns out that the culprit was niceScroll (http://areaaperta.com/nicescroll/).

Found some funny forum posts, some angry guy sarcastically saying, you know, space, that separates words?

Anyway, there’s an option to disable space bar scrolling (which in my opinion should be disabled by default). Anyway, to sort it, just feed in the spacebarenabled: false option:

//nicescroll
    $("html").niceScroll({
        zindex:999,
        cursorborder:"",
        cursorborderradius:"2px",
        cursorcolor:"#191919",
        cursoropacitymin:.5,
        spacebarenabled:false
    });
    function initNice() 
    {
        if($(window).innerWidth() <= 960) 
        {
            $('html').niceScroll().remove();
        } 
        else 
        {
            $("html").niceScroll({zindex:999,cursorborder:"",cursorborderradius:"2px",cursorcolor:"#191919",cursoropacitymin:.5});
        }
    }
    $(window).load(initNice);
    $(window).resize(initNice);
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s