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

Callbacks (onLeave) not working? #117

Closed
spaszwerg opened this issue Sep 10, 2019 · 7 comments
Closed

Callbacks (onLeave) not working? #117

spaszwerg opened this issue Sep 10, 2019 · 7 comments
Labels

Comments

@spaszwerg
Copy link

@spaszwerg spaszwerg commented Sep 10, 2019

Hi Alvaro,
I´m struggeling to get the callbacks working. After several tests with different files, I took your current master and tried to get it working with your examples.
Doesn´t work there too!

I uploaded the contents of your master to my webspace and just changed the example.html file in the example folder.
I added the example code from the docs to the jQuery logic.

$(document).ready(function() {
            $('#myContainer').multiscroll({
            	sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE'],
            	anchors: ['first', 'second', 'third'],
            	menu: '#menu',
            	navigation: true,
            	navigationTooltips: ['One', 'Two', 'Three'],
            	loopBottom: true,
            	loopTop: true,
				onLeave: function(index, direction){
					//after leaving section 2
					if(index == '2' && direction =='down'){
						alert("Going to section 3!");
					}
					else if(index == '2' && direction == 'up'){
						alert("Going to section 1!");
					}
				}
            });
        });

Whats my mistake?

Very looking forward to hear from you.
All the best, Chris

http://dev.schuetz-mediendesign.de/multiscroll/examples/example.html

@alvarotrigo

This comment has been minimized.

Copy link
Owner

@alvarotrigo alvarotrigo commented Sep 10, 2019

Please provide an isolated reproduction in jsfiddle.net or codepen.io with no CSS or JS files external to fullPage.js and the minimum amount of HTML code. Use empty sections unless strictly necessary for the reproduction.

Perhaps you might find useful to read my article regarding how to create isolated reproductions.

@spaszwerg

This comment has been minimized.

Copy link
Author

@spaszwerg spaszwerg commented Sep 10, 2019

Hi Alvaro,
a good article, thanks!
Here is the fiddle: https://jsfiddle.net/schuetzmedia/drugtb47/3/

@alvarotrigo

This comment has been minimized.

Copy link
Owner

@alvarotrigo alvarotrigo commented Sep 10, 2019

You are missing the nextIndex param in the function params.
Those have to be in order as in any other JS function :)

onLeave: function(index, nextIndex, direction){

Demo online:
https://jsfiddle.net/39rfvz65/

@spaszwerg

This comment has been minimized.

Copy link
Author

@spaszwerg spaszwerg commented Sep 10, 2019

I see ;o)
Would it make sense to alter the example in the docs for better understanding?

Thanks a lot!

@alvarotrigo

This comment has been minimized.

Copy link
Owner

@alvarotrigo alvarotrigo commented Sep 11, 2019

Would it make sense to alter the example in the docs for better understanding?

Uh! Totally! I didn't notice the mistake there :)

Would you like to commit a pull request for it?

@spaszwerg

This comment has been minimized.

Copy link
Author

@spaszwerg spaszwerg commented Sep 11, 2019

I´m honestly not that familliar with github ;o)

alvarotrigo added a commit that referenced this issue Sep 11, 2019
@alvarotrigo

This comment has been minimized.

Copy link
Owner

@alvarotrigo alvarotrigo commented Sep 11, 2019

No worries! I've done it myself now :)

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.