Here is the code extract which works well with 2 pages:
I'm using swipeview to handle a large number of pages. From the creator of iScroll.