Skip to content

Commit ed98cda

Browse files
committed
avoid interference of hSwipe and vSwipe
1 parent 1e66fcc commit ed98cda

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/js/jquery.swipebox.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@
290290
vDistance = null,
291291
vSwipe = false,
292292
hSwipe = false,
293-
hSwipMinDistance = 10,
293+
hSwipMinDistance = 50,
294294
vSwipMinDistance = 50,
295295
startCoords = {},
296296
endCoords = {},
@@ -405,16 +405,15 @@
405405

406406
vSwipe = false;
407407
return;
408-
} else if ( hDistance >= hSwipMinDistance ) {
409-
410-
// swipeLeft
411-
$this.getPrev();
412-
413-
} else if ( hDistance <= - hSwipMinDistance ) {
414-
415-
// swipeRight
416-
$this.getNext();
417-
408+
} else if ( hSwipe ) {
409+
if( hDistance >= hSwipMinDistance ) {
410+
// swipeLeft
411+
$this.getPrev();
412+
} else if ( hDistance <= - hSwipMinDistance ) {
413+
// swipeRight
414+
$this.getNext();
415+
}
416+
hSwipe = false;
418417
} else {
419418
// tap
420419
if ( ! bars.hasClass( 'visible-bars' ) ) {

0 commit comments

Comments
 (0)