Updating current page index when scrolling to page.