Skip to content
This repository was archived by the owner on Mar 27, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,25 @@ IScroll.prototype = {

pos.left -= this.wrapperOffset.left;
pos.top -= this.wrapperOffset.top;

// set current page to page containing element scrolling to
var self = this;
for (var i = 0; i < self.pages.length; i++) {
var minWidth = self.pages[i][0].width * id;
var maxWidth = minWidth + self.pages[i][0].width;

var minHeight = self.pages[i][0].height * id;
var maxHeight = minHeight + self.pages[i][0].height;

if (Math.abs(pos.left) >= minWidth && Math.abs(pos.left) < maxWidth) {
self.currentPage.x = minWidth;
self.currentPage.pageX = id;
}
if (Math.abs(pos.top) >= minHeight && Math.abs(pos.top) < maxHeight) {
self.currentPage.y = minHeight;
self.currentPage.pageY = id;
}
}

// if offsetX/Y are true we center the element to the screen
if ( offsetX === true ) {
Expand Down