Over scrolling

When I scroll I scroll one section at a time which is working. However, if the user keep scrolling it'll go from section 1 to 7 not section 1 to 2. Is there a way to cancel scrolling for a sec or some way to disable scroll?
10 Replies
kingtigerknight
kingtigerknight•3y ago
Basically like like this website https://kuon.space/#top When you scroll you don't scroll pass the 1st section until the animation is done or something like that.
KUON YAGI PORTFOLIO
KUON YAGI PORTFOLIO
KUON YAGI PORTFOLIO / Web designer / Markup engineer
vince
vince•3y ago
You probably want to set a timeout on your scroll function So that when the user scrolls, it only calls an event once
kingtigerknight
kingtigerknight•3y ago
how would I combine event listen and timeout? do I timeout after the user scroll or set a time out and run it when the user scroll it?
vince
vince•3y ago
element.addEventListener('scroll', (event) => {
setTimeout({
scrollElement.scrollTo();
), 1000);
});
element.addEventListener('scroll', (event) => {
setTimeout({
scrollElement.scrollTo();
), 1000);
});
Forgive me if this is wrong; I'm going off memory But I think this is what I did when I did something similar to you Hopefully this at least points you in the right direction; not the most experienced here with JS
kingtigerknight
kingtigerknight•3y ago
hmmm don't seems to work... here's my code on how I think this person did it
kingtigerknight
kingtigerknight•3y ago
everything works, but I need to find out how to make that setTimeout to work. When I added it given me an error saying '{' is expected or required statement.
kingtigerknight
kingtigerknight•3y ago
Here's where I put the setTimeout
kingtigerknight
kingtigerknight•3y ago
Never mind, I have figure it out. I just use the timeline on the if after it reads the use scroll. Thankyou for the help 🙂
vince
vince•3y ago
Awesome, I was trying to set up a codepen for you and couldn't get it working 😅
kingtigerknight
kingtigerknight•3y ago
it's all good XD. Never would of thought about timeline without ya. Time to find more errors in the code XD
Want results from more Discord servers?
Add your server