SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    <?php while(!sleep()){code();} G.Schuster's Avatar
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Drag'n'Drop only within defined area (script.aculo.us/Prototype)

    Hello everyone,

    I am looking for a solution for an unelegant "problem".
    I want do drag and drop some elements (span, div, input etc.) within a defined "frame" - let's say a parent div that is 300px in width and 300px in height.
    If the dragged element hits the border the dragging should stop.

    Has anybody found a solution for this?
    If not I will have to go the ugly way and check the element when it is dropped and send it to the right place.

    Thanks in advance for any replies.

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi G.Schuster, Welcome to SPF!

    These demos don't use script.aculo.us/Prototype, but perhaps it will be useful to look at the code because they do implement dragStart/drag/dragEnd events, a "bounding rectangle" feature and a drag-n-drop feature:

    X Drag Demos

  3. #3
    <?php while(!sleep()){code();} G.Schuster's Avatar
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi MikeFoster,

    Thank your very much, the demos will help me very much.
    They also brought up a new idea for scaling objects

    Problem solved - thanks everyone!

  4. #4
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •