Loading ...
Sorry, an error occurred while loading the content.

yui's dragdrop

Expand Messages
  • flubsg
    experimenting with yui s dragdrop now. but cant seem to find an example where a user can reset the image s position (after it has been dragged) to its original
    Message 1 of 4 , Nov 29, 2006
    • 0 Attachment
      experimenting with yui's dragdrop now.

      but cant seem to find an example where a user can reset the image's
      position (after it has been dragged) to its original position.

      for eg:

      origX = 10
      origY = 10

      after move-
      x=15
      y=15

      what I'm trying to do is, upon clicking Reset.

      the x and y will be the same as before.

      so now:
      x = origX
      y = origY


      Anyone has any experience in this?

      Thanks much
      Cee
    • Dawn Endico
      The image moves around because the dragdrop code adds some style rules to the element. Try removing those rules in your endDrag event. I did this. ymmv var
      Message 2 of 4 , Nov 29, 2006
      • 0 Attachment
        The image moves around because the dragdrop code adds some style rules to the element. Try removing those rules in your endDrag event. I did this. ymmv

          var draggedElement = this.getEl();
          draggedElement.removeAttribute ("style");

        --
        http://www.tafoni.net/
      • Adam Moore
        ... If the reset button always takes the element back to its original position, you should use YAHOO.util.Dom.getXY to keep track of the element s initial
        Message 3 of 4 , Nov 30, 2006
        • 0 Attachment
          On Wed, Nov 29, 2006 at 01:22:03PM -0000, flubsg wrote:
          > experimenting with yui's dragdrop now.
          >
          > but cant seem to find an example where a user can reset the image's
          > position (after it has been dragged) to its original position.
          >
          > for eg:
          >
          > origX = 10
          > origY = 10
          >
          > after move-
          > x=15
          > y=15
          >
          > what I'm trying to do is, upon clicking Reset.
          >
          > the x and y will be the same as before.
          >
          > so now:
          > x = origX
          > y = origY

          If the reset button always takes the element back to its original
          position, you should use YAHOO.util.Dom.getXY to keep track of the
          element's initial position, and use YAHOO.util.Dom.setXY to set it back
          when the reset button is clicked.

          -Adam
        • flubsg
          thanks Dawn and Adam. to Adam: ya, I was exploring around and found that I m should use the DOM util. But I m not too sure of how to use it, as there aren t
          Message 4 of 4 , Dec 1, 2006
          • 0 Attachment
            thanks Dawn and Adam.

            to Adam:

            ya, I was exploring around and found that I'm should use the DOM util.
            But I'm not too sure of how to use it, as there aren't many examples
            using that. you have any idea?

            But I guess I've gotta explore more.

            thanks a lot again!
            cee


            >
            > If the reset button always takes the element back to its original
            > position, you should use YAHOO.util.Dom.getXY to keep track of the
            > element's initial position, and use YAHOO.util.Dom.setXY to set it back
            > when the reset button is clicked.
            >
            > -Adam
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.