• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Dragging clickable things
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: A little bit of Ajax in a 5.3 app?
  • Next by Date: Re: WO 5.4 / Axis 1.4 / Deserialization
  • Previous by thread: Re: A little bit of Ajax in a 5.3 app?
  • Next by thread: drawImage() really slow on Leopard
  • Index(es):
    • Date
    • Thread