Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent scrolling back to first slide after scrolled past

I'm using fullpage.js and was wondering how I would go about preventing the user from scrolling back to the initial (first) slide after they've scrolled past it?

I still want to be able to scroll between all subsequent slides as intended, but essentially remove the first slide once past it so that it cannot be scrolled back up (basically making the second slide the first, as if the first is no longer there).

Hopefully this makes sense? The first slide is basically an intro/video slide and I only want it shown on initial page load, then after scrolled passed for it to no longer be accessible.

like image 754
shparkison Avatar asked Oct 31 '22 06:10

shparkison


1 Answers

Just use setAllowScrolling whenever you arrive to the 2nd section:

$('#fullpage').fullpage({
    afterLoad: function(anchorLink, index){
        //on load section 2...
        if(index == 2){
            $.fn.fullpage.setAllowScrolling(false, 'up');
        }else{
            $.fn.fullpage.setAllowScrolling(true, 'up');
        }
    }
});

Demo online

like image 100
Alvaro Avatar answered Nov 12 '22 18:11

Alvaro