在两个可拖动div之间绘制线 [英] Drawing a line between two draggable divs

查看:134
本文介绍了在两个可拖动div之间绘制线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,我知道此类问题之前已在以下链接中提出:问题1 问题2 问题3 。但我的问题与已经提出的问题截然不同。

Yes I know that this kind of questions have been asked before in the following links: Question 1, Question 2 and Question 3. But my question is quite different from already asked questions.

我想要的是以下内容:我有两个可拖动的div,在它们之间有一个连接器(一条直线)(用SVG线绘制)。当我移动这些可拖动的div时,我需要在它们之间移动一个连接器。我的问题更类似于问题3 ,但是在那个问题中,一旦用户在div之间创建连接,那些div停止可拖动,因此他们不在乎刷新连接器。

What I want is following: I have two draggable divs and have a connector (a straight line) between them (drawn with SVG line). When I move these draggable divs I need to move a connector between them accordingly. My question is more similar to the Question 3, but there in that question, once a user creates a connection between divs those divs stop being draggable, so they don't care about refreshing connectors.

有没有人遇见过我所说的任何工作示例或演示?或者,任何人都可以给我任何想法如何以最佳的方式做到这一点吗?

Has anybody ever met any working example or demo of what I am saying? Or, could anybody give me any ideas of how to do that in an optimal way please?

在这种情况下,我使用jQuery作为javascript框架(如果它值得知道)。

Just in case, I am using jQuery as a javascript framework (if it worth to know that).

非常感谢。

UPDATE 1

href =http://kennykee.com/?p=15>演示,但它的工作非常非常糟糕,我会说错误。

I have found this demo also, but it works very very bad, I would say incorrectly.

推荐答案

使用jsPlumb - 用于在网页上绘制自定义线条的最佳库。

Use jsPlumb - best library for drawing custom lines on webpage.

https://jsplumbtoolkit.com/demos.html

这篇关于在两个可拖动div之间绘制线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆