I've got two floating divs which can be re-positioned by the user using drag and drop. I want to draw a line between the two divs and have it adjust itself (size and positions) to the movements of the divs.
The goal is to get some sort of chartflow/diagram alike construction within the browser.
What would be the best method to do this?
I've got two floating divs which can be re-positioned by the user using drag and drop. I want to draw a line between the two divs and have it adjust itself (size and positions) to the movements of the divs.
The goal is to get some sort of chartflow/diagram alike construction within the browser.
What would be the best method to do this?
If you're going to do anything more than very basic drawing/figures, then I would remend a drawing library such as RaphaelJS. It greatly simplifies things for you. See an example: http://jsfiddle/sveinatle/RVykE/1/
That example is not a perfect implementation, but it shows how much help you get from Raphael.
JS Plumb:
http://jsplumb/jquery/demo.html
SVG, Canvas, or VML
Jquery, Mootools, or YUI
Here's a version using just HTML, jQuery and some trigonometry!
Still needs a bit of tweaking but it's mostly there.
http://jsfiddle/gKj35/2/
I can think of three ways: