For all the community has done for me and my coding, I thought I should share this. I use Ajax draggables all over the place. A lot of times I wanted to be able to click on a draggable and have it do an action (like a hyperlink), but when I'd drop the thing it would fire the hyperlink. So I added the following code to draggables to disable the onclick event when dragging and then enable the onlick again when it is dropped. I don't save any previous onclick code, so it is limited, but it has worked for my needs.

Here is the draggable wod:
Draggable: AjaxDraggable {
        draggableObject = fileable;
        revert = true;
starteffect = "function(){event.target.onclick=function(){return false;};}"; endeffect = "function(){event.target.onclick=function() {event.target.onclick=function(){return true;};return false;};}";
}

The starteffect cancels the click event registration on whatever the event target is. The endeffect sets onclick at the target to a function that will enable the onclick event the next time it is clicked (which happens when it is dropped) but will return false after reenabling onclick. %-)

Then when someone clicks on the link after dragging and dropping the link works fine.

John
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to