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

Draggable div only inside another div

Expand Messages
  • rodiniz2003
    I have two divs and one inside the other. I want to know how do I make the smaller div draggable only inside the bigger div. (something like the silder does)
    Message 1 of 3 , Aug 2, 2006
    • 0 Attachment
      I have two divs and one inside the other. I want to know how
      do I make the smaller div draggable only inside the bigger div.
      (something like the silder does)
      Thanks in advance.
    • Michael Trier
      I just went through this. Unfortunately the constraint code in YUI only restricts based on movement from the original location. So you need to figure out the
      Message 2 of 3 , Aug 2, 2006
      • 0 Attachment
        I just went through this.  Unfortunately the constraint code in YUI only restricts based on movement from the original location.  So you need to figure out the starting size of your outer div and the size of your inner div and do the math so you produce the x / y movement from the starting location of the inner div.  Then use the setXConstraint, setYConstraint methods to limit the inner div.  Check out the grid example to help you get started.

        Michael

        On 8/2/06, rodiniz2003 <rodiniz@...> wrote:

        I have two divs and one inside the other. I want to know how
        do I make the smaller div draggable only inside the bigger div.
        (something like the silder does)
        Thanks in advance.

        _
        .


      • r_p_bouman
        ... Yes, use: void setXConstraint ( iLeft, iRight, iTickSize) void setYConstraint ( iUp, iDown, iTickSize)
        Message 3 of 3 , Aug 2, 2006
        • 0 Attachment
          --- In ydn-javascript@yahoogroups.com, "rodiniz2003" <rodiniz@...> wrote:
          >
          > I have two divs and one inside the other. I want to know how
          > do I make the smaller div draggable only inside the bigger div.
          > (something like the silder does)
          > Thanks in advance.
          >

          Yes, use:

          void setXConstraint (<int> iLeft, <int> iRight, <int> iTickSize)
          void setYConstraint (<int> iUp, <int> iDown, <int> iTickSize)
        Your message has been successfully submitted and would be delivered to recipients shortly.