There is a bug if you add more than 9 pages, when you move to the 10th page it jumps to the 11th page, causing the whole thing to break eventually.
You can easily replicate this if you simply add more colors to the demo here: http://joehewitt.github.com/scrollability/example2.html
Try increasing the array of colors to 12.
I’m trying to debug the source, I’ll post here if I can find anything.
OK, it’s the margin thing that does this, setting a margin to the .page as in the example makes the position/viewport calculate the wrong pageIndex eventually.
In the demo, it happens after 9 pages, since that is the breaking point when position is -340 and viewport is 320 (-10 becomes -12).
I’m not sure how to fix this, I guess you can detect extra animation margins and add it to the viewport for a closer calculation, but I’m not sure what effect this could have.