Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Drag and Drop then Draw Line in JQUERY Reply To: Drag and Drop then Draw Line in JQUERY

#180093
nixnerd
Participant

Look into something like this:

http://stackoverflow.com/questions/4903530/how-to-get-the-position-of-a-draggable-object

You need to get the position of each element with a function that’s called every time you move anything. But… that’s a shipload of state management. Also… I’m not really sure how you should go about drawing the lines.

Typically, you’d use canvas for something like this. But… it looks like you’re trying to do some straight up DOM action. I would recommend this:

http://snapsvg.io/

In theory, you should be able to pass your coordinates to some function that handles the drawing of these svg lines.

Godspeed Nestle.

Hey, is there any way you could make this your Gravatar: