SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Mar 27, 2007, 11:04 #1
- 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.
-
Mar 27, 2007, 12:48 #2
- 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 DemosCross-Browser.com, Home of the X Library
-
Mar 28, 2007, 00:33 #3
- 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!
-
Mar 28, 2007, 07:22 #4
- Join Date
- Dec 2002
- Location
- Alabama, USA
- Posts
- 2,560
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Cross-Browser.com, Home of the X Library
Bookmarks