Browse Source

Fixed an error when swiping and removed unnecessary detection

Tobias Reich 11 years ago
parent
commit
605ef84c0b
3 changed files with 5 additions and 3 deletions
  1. 3 3
      assets/js/init.js
  2. 2 0
      assets/js/swipe.js
  3. 0 0
      assets/min/main.js

+ 3 - 3
assets/js/init.js

@@ -127,9 +127,9 @@ $(document).ready(function(){
 			})
 
 			/* Swipe on mobile */
-			.swipe().on('swipeStart', function() { swipe.start($("#image")) })
-			.swipe().on('swipeMove', function(e) { swipe.move(e.swipe) })
-			.swipe().on('swipeEnd', function(e) { swipe.stop(e.swipe, photo.previous, photo.next) });
+			.swipe().on('swipeStart', function() { if (visible.photo()) swipe.start($("#image")) })
+			.swipe().on('swipeMove', function(e) { if (visible.photo()) swipe.move(e.swipe) })
+			.swipe().on('swipeEnd', function(e) { if (visible.photo()) swipe.stop(e.swipe, photo.previous, photo.next) });
 
 	}
 

+ 2 - 0
assets/js/swipe.js

@@ -26,6 +26,8 @@ swipe = {
 
 		console.log(e);
 
+		if (swipe.obj===null) return false;
+
 		swipe.offset = -1 * e.x;
 
 		swipe.obj.css({

File diff suppressed because it is too large
+ 0 - 0
assets/min/main.js


Some files were not shown because too many files changed in this diff