Try starting a timer on mouse down, and only register the click event if the timer is less than x milliseconds. The fringe case for this would be users who click for seconds, or who drag in milliseconds. I'm .positive. this is not the best possible way to handle this, but it could be a last resort.

Nic
http://www.twitter.com/nicluciano
Sent from my iPhone

On Feb 11, 2009, at 7:43 PM, legofish <pen...@gmail.com> wrote:


no takers?

On Feb 11, 1:54 pm, legofish <pen...@gmail.com> wrote:
Hi,

I am using the "drag" plugin (http://blog.threedubmedia.com/2008/08/
eventspecialdrag.html) to design some interactions for a UI element.

The element foo, needs to respond to a click, as well as to a drag
(different responses for each). The plugin gives you handy drag events
to work with.

So I have:
$("#foo").bind('dragend', function(e){   dragged()   });
$("#foo").bind('click', function(e){   clicked()   });

When foo is simply clicked on, then clicked() is executed and all is
well.
However, when foo is dragged, dragged() is called and right after that
clicked() is called as well.
I don't want clicked() to be called when foo is dragged, but I can't
seem to figure out how to avoid that. Help is much appreciated.

Reply via email to