SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: jQuery drag and drop question
-
May 30, 2009, 12:33 #1
- Join Date
- Oct 2008
- Posts
- 54
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
jQuery drag and drop question
Hi guys,
I am using jQuery now. I can drag and drop.
But I want to drag an IMG for example and I want the user ONLY to be able to drag it into a specific div, otherwise I want it to revert for example or just not work. Any idea's how i can do so?
thanks
-
May 30, 2009, 13:39 #2
- Join Date
- Jul 2008
- Posts
- 5,757
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
May 31, 2009, 09:56 #3
- Join Date
- Oct 2008
- Posts
- 54
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thank u ..
but isnt there any more explanation about how to use it?
or an example of this one?
i checked the link but it doesnt explain a lot to me since i am new to jQuery and libraries in general
-
Jun 5, 2009, 07:32 #4
If you want to make it so an item can only be dropped on a droppable and return to it's hope position otherwise you can use the following code.
Code:$(".draggableItem").draggable({ revert: "invalid" }); $(".droppableItem").droppable();
This is really all you need to get the basic behavior. To do more, like having an item bounce into the bounds of a div and center itself (probably not what you're after) you'll need to do more code but this is really all you need to get the behavior you're after.
Bookmarks