Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can onLeave fire moveTo ? #2255

Closed
user928 opened this issue Sep 11, 2016 · 2 comments
Closed

Can onLeave fire moveTo ? #2255

user928 opened this issue Sep 11, 2016 · 2 comments
Labels

Comments

@user928
Copy link

user928 commented Sep 11, 2016

Description

Hello, is it possible to skip some section while moving up or down?

let's say that I want to skip the 2nd section if I move up from 1st, so 2nd is skipped and I arrive on 3rd section. Is that achievable like this?

onLeave: function(index, nextIndex, direction){

            //from #1 to #2 UP direction
            if(index == 1 && nextIndex == 2 && direction =='up'){
                $.fn.fullpage.moveTo(3);
            }

        }

Link to my demo:

http://codepen.io/user928/pen/xEGBmd?editors=0010

@alvarotrigo
Copy link
Owner

alvarotrigo commented Sep 11, 2016

See the solution I proposed here

@user928
Copy link
Author

user928 commented Sep 11, 2016

Thank you, it is working great !

I will paste part of your code it here it here, just in case someone need a quick look

//IE < 10 pollify for requestAnimationFrame
window.requestAnimFrame = function(){
    return window.requestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.oRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        function(callback){ callback() }
}();

$('#fullpage').fullpage({
    onLeave: function(index, nextIndex, direction) {
        requestAnimFrame(function(){
            if (index == 2 && direction == 'down') {   
              $.fn.fullpage.moveTo(4);
            }
        });
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants