Jump to content

Drag And Drop Function


norNerd
 Share

Recommended Posts

Hi everyone.I've been searching for a while, and cant seem to find the answer to my question.I'm searching for a function that makes it possible to take a image, and drag it into a div tag, my code without function looks like this:

<!-- My Draggable Images --><img src="draggable_image1.jpg" width="250" height="250" /><img src="draggable_image2.jpg" width="250" height="250" /><img src="draggable_image3.jpg" width="250" height="250" /><img src="draggable_image4.jpg" width="250" height="250" /><!-- My Drop-accepting divs --><div id="#droparea1"> </div><div id="#droparea2"> </div><div id="#droparea3"> </div><div id="#droparea4"> </div>

So as you see, its not so much that i want to be done, but i cant find a way to do this at all.On the page it will be more draggable images and dropable areas, so might be best to use a id that goes for all dropareas.But you decide :)Hope you understand my question and can help.Kristian

Link to comment
Share on other sites

There are several drag and drop libraries that people have made, many of them will also let you set up a valid drop area for an element. Walter Zorn has one here:http://www.walterzorn.com/dragdrop/dragdrop_e.htmHis library includes a method on the objects called getEltBelow that will return the element that a dragged item is over, you can use that for a hit test.

Link to comment
Share on other sites

Thanks justsomeguy, i'll try to figure out how to set this up today.I had an account here before, named kristian_c, and because of you, I now have a good job as a php developer.So thanks for helping me out with understanding the more advanced basics of php.Kris

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...