zazvorniki
zazvorniki

Reputation: 3602

SwipeRight using touchSwipe.js

I'm using the touchSwipe plugin for mobile side swiped motions. I'm having a bit of trouble though.

I can get the left swipe to work just fine.

$(".grid").swipe({
  swipeLeft:function(event, direction, distance, duration, fingerCount) {
     alert('swipe left');
  }
});  

but for some odd reason I cannot get the right swipe to work and I'm not really seeing what I am doing wrong.

$(".grid").swipe({
  swipeRight:function(event, direction, distance, duration, fingerCount) {
    alert('swipe right');
  }
}); 

Can someone help me see what the heck I'm doing wrong?

Upvotes: 0

Views: 1914

Answers (1)

PherricOxide
PherricOxide

Reputation: 15919

Try setting them both at the same time maybe?

$(".grid").swipe({
  swipeLeft:function(event, direction, distance, duration, fingerCount) {
     alert('swipe left');
  }, 
  swipeRight:function(event, direction, distance, duration, fingerCount) {
     alert('swipe right');
  }
});

Depending on order, you might be erasing the swipeRight when you set the swipeLeft like that.

Upvotes: 4

Related Questions