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ā€¢2y 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ā€¢2y 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ā€¢2y 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ā€¢2y 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ā€¢2y ago
hmmm don't seems to work... here's my code on how I think this person did it
kingtigerknight
kingtigerknightā€¢2y 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ā€¢2y ago
Here's where I put the setTimeout
kingtigerknight
kingtigerknightā€¢2y 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ā€¢2y ago
Awesome, I was trying to set up a codepen for you and couldn't get it working šŸ˜…
kingtigerknight
kingtigerknightā€¢2y ago
it's all good XD. Never would of thought about timeline without ya. Time to find more errors in the code XD