最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Draw lines to connect divs - Stack Overflow

programmeradmin5浏览0评论

I currently have this set up: /

They are draggable and I am trying to find a way to have lines connect them, even when they are dragged. Having an easy way to show how each is related and which should be connected is ideal!

Thanks!!!

I currently have this set up: http://sandbox.brightboxstudios./orgmap/

They are draggable and I am trying to find a way to have lines connect them, even when they are dragged. Having an easy way to show how each is related and which should be connected is ideal!

Thanks!!!

Share Improve this question edited Aug 22, 2012 at 2:23 Reuben asked Aug 21, 2012 at 3:51 ReubenReuben 2,7516 gold badges32 silver badges47 bronze badges 1
  • Possible duplicate of Drawing a line between two draggable divs – balupton Commented Nov 5, 2018 at 20:42
Add a ment  | 

4 Answers 4

Reset to default 3

You should consider using the D3.js library. In particular this example is what I think you are looking for: http://mbostock.github./d3/ex/force.html

Take a look at this: jQuery - use canvas to draw lines between divs

I'd start with that code, and just re-draw the lines every time the divs change location.

You may try KineticJS too. I think that it will provide what you want easily. http://www.kineticjs./

Here you can find lots of tutorials: http://www.html5canvastutorials./kineticjs/html5-canvas-events-tutorials-introduction-with-kineticjs/

You can also try jsPlumb, a JavaScript library that can connects divs together. It's really simple to use and there are plenty of demos on that page.

发布评论

评论列表(0)

  1. 暂无评论