Href inside sortable dragging instead of clicking intermittently, in IE7

38 views
Skip to first unread message

Hippyjim Starbrook

unread,
Nov 9, 2008, 3:58:24 PM11/9/08
to Prototype & script.aculo.us
Hi

I have two sortables that have divs as the draggable elements.
Included in those divs are some anchor tags to make some buttons that
call javascript functions elsewhere in the page.

It all works fine in Firefox & Safari, but in IE7 it's a matter of
luck if the link will accept clicks. Sometimes you click the link,
sometimes the div acts like it's being dragged (it fades as per the
start of the drag, but doesn't move). I've tried to click the mouse as
quickly as possible, and holding it completely still, but it makes no
difference.

This is a showstopper for me, as IE is such a big part of my audience.
Anyone got any suggestions?

A similar (and possibly related_ problem. In the same page i have a
draggable with a href link to "close" it using blindup in the handle.
sometimes in IE clicking the link makes the draggable move up to the
top left corner of the window, and the javascript to close the
draggable doesn't fire.

All help appreciated.

Thanks

Alex Mcauley

unread,
Nov 10, 2008, 7:05:32 AM11/10/08
to prototype-s...@googlegroups.com
The bind's are bubbling up the DOM ... you need to look at Event.stop(event)
to stop this happening

Hippyjim Starbrook

unread,
Nov 10, 2008, 9:52:09 AM11/10/08
to prototype-s...@googlegroups.com
Thanks Alex. I'm looking at it now. So I'm right in thinking the
problem is due to the drag event being called before the onClick? Just
trying to figure out whre I put the Event.stop(event) - can I include
that in the sortable.create?

Hippyjim Starbrook

unread,
Nov 11, 2008, 7:42:14 PM11/11/08
to prototype-s...@googlegroups.com
Ok, I had a mess with it, and i'm totally lost. I need the onclick
event to fire when the link is clicked, and the drag should only
happen if the mouse is moved while the button is held down (at this
point I'd even settle on the drag just not working on the link at all
- there's plenty of other stuff in the div for the user to grab hold
of and drag). At the moment the onclick rarely actually fires.

I tried putting Event.stop(event) into the function in the onclick to
prevent the mouse activity bubbling to the parent with the drag, but
that just tells me that event is not defined (that's *when* the
onclick fires and the drag doesn't steal all the action).

How can I force the links to be the things that take the mouseclick -
rather than it's parent?

For the moment, I've given up and just made another part of the div
the drag handle, so no dragging happens on or near the link - but it's
not ideal - i want more of the div to be able to act as the drag
handle - surely this can't be so rare a question, but I can't find
anything in google to stop things bubbling this way around - it's all
about stopping the onclick firing when it shouldn't (if only!!)!

Alex Mcauley

unread,
Nov 12, 2008, 4:08:45 AM11/12/08
to prototype-s...@googlegroups.com
can you put your code in for the event stop or all of the javascript used
(not scriptaculous or prototype!!) and the xhtml used in it and i will help
you figure out the problem

Thanks
Alex

Reply all
Reply to author
Forward
0 new messages