Skip to content

Commit

Permalink
Fixed fixLoop() with onTouchMove
Browse files Browse the repository at this point in the history
onTouchMoveStart plugins called only on the first move
  • Loading branch information
ekzobrain committed Sep 9, 2013
1 parent c9aa96e commit 7b2652a
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions dev/idangerous.swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ var Swiper = function (selector, params) {
_this.positions.start = _this.positions.current = _this.getWrapperTranslate();

//Set Transform
_this.setWrapperTranslate(_this.positions.start);
//_this.setWrapperTranslate(_this.positions.start);

//TouchStartTime
_this.times.start = (new Date()).getTime();
Expand Down Expand Up @@ -1196,13 +1196,6 @@ var Swiper = function (selector, params) {
}
event.assignedToSwiper = true;

//Moved Flag
if (!_this.isMoved) {
if (params.loop) _this.fixLoop();
if (params.onTouchMoveStart) params.onTouchMoveStart(_this);
}
_this.isMoved = true;

//Block inner links
if (params.preventLinks) {
_this.allowLinks = false;
Expand All @@ -1217,7 +1210,19 @@ var Swiper = function (selector, params) {
}
if (!isTouchEvent || event.touches.length == 1) {

_this.callPlugins('onTouchMoveStart');
//Moved Flag
if (!_this.isMoved) {
_this.callPlugins('onTouchMoveStart');

if (params.loop) {
_this.fixLoop();
_this.positions.start = _this.getWrapperTranslate();
}
if (params.onTouchMoveStart) params.onTouchMoveStart(_this);
}
_this.isMoved = true;

// cancel event
if(event.preventDefault) event.preventDefault();
else event.returnValue = false;

Expand Down

0 comments on commit 7b2652a

Please sign in to comment.