Dragging clickable things
Dragging clickable things
- Subject: Dragging clickable things
- From: John Larson <email@hidden>
- Date: Tue, 26 Feb 2008 12:50:10 -0600
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. false;};}"; endeffect = "function(){event.target. 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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden