admin管理员组文章数量:1433480
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?
Share Improve this question asked Jul 1, 2012 at 18:55 user6user6 2,0532 gold badges25 silver badges29 bronze badges 1- Can you post some kind of example of what you're trying to achieve, and also, what have you tried to implement to solve this problem? – Brandon Buck Commented Jul 1, 2012 at 19:02
4 Answers
Reset to default 3If 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:
- you can use svg
- you can use html canvas
- you can use pure html( divs with height = 1 will be horizontal lines, and divs with width = 1 will be vertical lines). You can bine these lines to create a line segment.
本文标签: javascriptCreate a line between 2 floating divs and adjust to movementStack Overflow
版权声明:本文标题:javascript - Create a line between 2 floating divs and adjust to movement - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745602509a2665648.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论