This has been a very common question on this list. From my memory I believe
the most widely accepted solution is to create a separate drag handle for
the div, so you cannot drag it by click-holding over your link (therefore no
click event for it).
Another clever trick is to use a combination of mousedown/up event handlers
on the link (instead of onclick), a wasDragged flag, and possibly a timer.
Lol, that sentence just made me imagine MacGyver saying "Ok, I''ll
need a
piece of chewing gum, a paper clip, and all the pocket lint you have,
I''m
going to make a bomb and get us outta here" Anyway, the idea is to only
execute the "click" action if the mousedown/up pair occurs within so
many
milliseconds and the div has not been dragged (therefore if the timer goes
off or the div gets dragged it wasn''t a real click so don''t do
the click
action)
On 10/3/06, Karim Shehadeh
<karim.shehadeh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
>
> I''ve got a div that contains a link. I''ve made that div
draggable.
> The problem is that when I drag the div then release it will do the
> drag just fine but when I release it will navigate to the link inside
> the div. That kind of makes sense but is there a good way to get
> around that problem? I guess what I need to happen is for it to act as
> a normal link when not being dragged and to ignore clicks when
it''s
> part of a drag/drop operation.
>
> Thanks,
> Karim
>
>
> >
>
--
Ryan Gahl
Application Development Consultant
Athena Group, Inc.
Inquire: 1-920-954-9798 x2903
Blog: http://www.someElement.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---