Skip to content
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
13 changes: 12 additions & 1 deletion src/swipeview.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ var SwipeView = (function (window, document) {
deltaX = point.pageX - this.pointX,
deltaY = point.pageY - this.pointY,
newX = this.x + deltaX,
dist = Math.abs(point.pageX - this.startX);
dist = Math.abs(point.pageX - this.startX),
wrapperBound = this.wrapper.getBoundingClientRect(),
absoluteWrapperLeft = wrapperBound.left + window.pageXOffset,
absoluteWrapperRight = absoluteWrapperLeft + wrapperBound.width;

this.moved = true;
this.pointX = point.pageX;
Expand All @@ -336,6 +339,14 @@ var SwipeView = (function (window, document) {
return;
}

// If using touch we need to determine if the user swiped outside of the bounds of the
// container. This is not an issue for non touch which would never get in here.
if(hasTouch){
if (point.pageX < absoluteWrapperLeft || point.pageX > absoluteWrapperRight){
return;
}
}

e.preventDefault();

this.directionLocked = true;
Expand Down