JavaScript how to check drag direction

iwan picture iwan · Jun 3, 2011 · Viewed 8.6k times · Source

I am trying to monitor dragStart and dragEvent javascript, in order to conclude its direction, UP or DOWN.

However i could not get any detail in arguments passed by the event -- that help to conclude.

Is there any better way to check drag direction , up or down?

Note: my problem is specifically happening at mojo javascript at webos

Thanks, -iwan

Answer

Edgar picture Edgar · Jun 3, 2011

It won't tell you the direction, but you can get the position of the element you're dragging and figure out which direction it's going.

This might be helpful: http://dunnbypaul.net/js_mouse/.