📝 Originally published (in Japanese) at forge.workstyle.tech .
TL;DR Wheel event counts do not match the distance moved, so counting events can skip pages. Convert wheel distance into progress using the page height. After input stops, use the progress to choose the destination, and handle touch input separately on mobile.
Conclusion First
If page turns are based on the number of wheel events, a small amount of scrolling can advance multiple pages. That’s because the number of wheel events doesn’t correspond to the distance traveled. You can make page changes match the amount of scrolling by dividing the distance by the page height, then—once scrolling stops—using the halfway point to decide whether to move to the next page or return to the current one.
Why Does Scrolling Send the Page Flying?
The page was jumping because each wheel event was treated as a page turn.…