rochal / jQuery-slimScroll

small jQuery plugin that transforms any div into a scrollable area with a nice scrollbar. Demo and more:
http://rocha.la/jQuery-slimScroll
2.23k stars 924 forks source link

How do set 'scroll:false' to specific block in pages? #143

Open 6pm opened 10 years ago

6pm commented 10 years ago

my site - template.promo-gear.itembridge.com i want to not scroll page "works" I do not want to plugin add div "slimScrollDiv" and "scrollable"

Djules commented 10 years ago

You want to disable the scroll on the section "works", right ?

It's related to the library fullpage.js, not slimScroll.

Any way, you can use the afterLoad event and check if the current section is the one you need. If yes, use both setAllowScrolling and setKeyboardScrolling to disable the scrolling. Example :

$('#fullpage').fullpage({
    ...
    afterLoad: function(anchorLink, index){
        // using index or anchorLink

        if (index == '4') { // if (anchorLink == 'works')

            // Section 4 (#works) ended loading

            // disable scrolling for mousewheel AND keyboard
            $.fn.fullpage.setAllowScrolling(false);
            $.fn.fullpage.setKeyboardScrolling(false);
        }
    }
});