Skip to content

Commit bbc2e0d

Browse files
committed
touchend might not have a touch
1 parent a0ad72b commit bbc2e0d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/js/jquery.swipebox.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@
326326
endCoords = event.originalEvent.targetTouches[0];
327327

328328
if ( !hSwipe && plugin.settings.closeBySwipe ) {
329+
vDistanceLast = vDistance;
329330
vDistance = endCoords.pageY - startCoords.pageY;
330331
if ( Math.abs( vDistance ) >= vSwipMinDistance || vSwipe ) {
331332
var opacity = 0.75 - Math.abs(vDistance) / slider.height();
@@ -337,6 +338,7 @@
337338
}
338339
}
339340

341+
hDistanceLast = hDistance;
340342
hDistance = endCoords.pageX - startCoords.pageX;
341343
hDistancePercent = hDistance*100/winWidth;
342344

@@ -381,12 +383,7 @@
381383
'transition' : 'transform 0.4s ease'
382384
});
383385

384-
endCoords = event.originalEvent.targetTouches[0];
385-
386-
vDistanceLast = vDistance;
387386
vDistance = endCoords.pageY - startCoords.pageY;
388-
389-
hDistanceLast = hDistance;
390387
hDistance = endCoords.pageX - startCoords.pageX;
391388
hDistancePercent = hDistance*100/winWidth;
392389

0 commit comments

Comments
 (0)