ngryman / jquery.finger

:v: jQuery touch & gestures, fingers in the nose.
https://ngryman.sh/jquery.finger/
MIT License
423 stars 66 forks source link

How do I get the direction when using drag #19

Closed jrdn91 closed 10 years ago

jrdn91 commented 10 years ago

I can't seem to figure out how I would go about gathering the information about if the drag direction is down or up, how would I detect this?

ngryman commented 10 years ago

Hey,

You have both orientation and direction parameters (cf. https://github.com/ngryman/jquery.finger#additional-event-parameters).

For example:

$('body').on('drag', '.touchme', function(e) {
  if ('vertical' == e.orientation)
    console.log('moving ', 1 == e.direction ? 'bottom' : 'top');
});