cubiq / iscroll

Smooth scrolling for the web
http://iscrolljs.com
MIT License
12.87k stars 3.8k forks source link

Stop vertical snap from creating pages past the scrollable range. #1134

Open RHM-DanielKlier opened 7 years ago

RHM-DanielKlier commented 7 years ago

Hi there,

this pull request fixes an issue with the snap feature in vertically scrolled lists where you could increase the page counter past the scrollable range using next() or the mouse wheel. I attached a demo page with a fairly minimal test case.

The setup is this:

Initially, the page count starts at 0. You can scroll 3 times until you reach the end of the list. The page count is now at 3 but subsequent clicks on "Next" will increase the page count up to 9 so that you would have to click "Prev" multiple times before the list actually scrolls up one element again.

Cheers Daniel

Attachment: Demo page. Extract next to the other demos. snap-max-scroll.zip