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
12 changes: 9 additions & 3 deletions src/swipeview.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ var SwipeView = (function (window, document) {
if (!this.initiated) return;

var point = hasTouch ? e.changedTouches[0] : e,
dist = Math.abs(point.pageX - this.startX);
dist = point.pageX - this.startX;

this.initiated = false;

Expand All @@ -375,8 +375,14 @@ var SwipeView = (function (window, document) {
}

// Check if we exceeded the snap threshold
if (dist < this.snapThreshold) {
this.slider.style[transitionDuration] = Math.floor(300 * dist / this.snapThreshold) + 'ms';
if (Math.abs(dist) < this.snapThreshold) {
this.slider.style.webkitTransitionDuration = Math.floor(300 * Math.abs(dist) / this.snapThreshold) + 'ms';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should be using the vendor free syntax ( style[transitionDuration] )

this.__pos(-this.page * this.pageWidth);
return;
}
// Check if swipe was cancelled by reversing swipe direction
if ((dist < 0 && this.directionX >= 0) || (dist > 0 && this.directionX <= 0)) {
this.slider.style.webkitTransitionDuration = Math.floor(300 * Math.abs(dist) / this.pageWidth) + 'ms';
this.__pos(-this.page * this.pageWidth);
return;
}
Expand Down