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

bug with option "beforeMove" #325

Open
iamrealmarsel opened this issue Dec 2, 2017 · 1 comment
Open

bug with option "beforeMove" #325

iamrealmarsel opened this issue Dec 2, 2017 · 1 comment

Comments

@iamrealmarsel
Copy link

Function in option "beforeMove" works twice. I mean, if you write
beforeMove: function(index) { console.log("hello")}
you'll see the word "hello" twice in console after one scrolling. How to fix it?

@auriga-dev
Copy link

auriga-dev commented Apr 15, 2018

I used a global variable to solve the problem but not very clean
`

var isScrolling = false
$(".main").onepage_scroll({
   sectionContainer: "section", 
   easing: "ease",                                           
   animationTime: 1000,           
   pagination: false,               
   updateURL: false,               
   beforeMove: function(index) {
   	if(isScrolling == false){ // DO YOUR THING IN THERE
   		isScrolling = true
   	}
   	
   },  
   afterMove: function(index) {isScrolling = false}, 
   loop: false,                   
   keyboard: true,                
   responsiveFallback: false, 
   direction: "vertical"           
});`

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

No branches or pull requests

2 participants