【发布时间】:2017-02-02 18:17:08
【问题描述】:
一旦用户单击,我有 2 个 DIV 需要用一条线连接。我以角度开发我的项目。谁能帮我?我真的需要解决方案。
查看我的 sn-p 以获得更清晰的信息。
.padding-answer-line-mapping
{
padding-bottom:8px;
}
.answer-container
{
width:40px;
height:40px;
background-color:#ccc;
border:1px solid #ccc;
margin:2px;
float:left;
text-align:center;
padding-top:8px;
cursor:pointer;
position:relative;
}
.answer-container:hover, .answer-container:focus, .answer-container:active
{
background-color: #0076e9;
color: white;
border: 1px solid #0076e9;
}
.round-pointer-right
{
position: absolute;
background-color:#ccc;
cursor:pointer;
width:10px;
height:10px;
border-radius: 50%;
right:0px;
top:14px;
margin-right:-20px;
}
.round-pointer-left
{
position: absolute;
background-color:#ccc;
cursor:pointer;
width:10px;
height:10px;
border-radius: 50%;
left:0px;
top:14px;
margin-left:-20px;
}
<link href="http://code.ionicframework.com/1.3.1/css/ionic.css" rel="stylesheet"/>
Match the following items.
<div class="row padding-answer-line-mapping">
<div class="col answer-container">
One
<div class="round-pointer-right"></div>
</div>
<div class="col">
</div>
<div class="col answer-container">
2
<div class="round-pointer-left"></div>
</div>
</div>
<div class="row padding-answer-line-mapping">
<div class="col answer-container">
Two
<div class="round-pointer-right"></div>
</div>
<div class="col">
</div>
<div class="col answer-container">
1
<div class="round-pointer-left"></div>
</div>
</div>
【问题讨论】:
-
到目前为止你尝试了什么,我可以看看你的完整代码吗?
-
我做了一些研究……但主要使用jquery或jSPlumb……从头开始开发容易吗?我不知道如何开始lol hoho。
-
由于 html 不提供开箱即用的此类功能,因此您必须发挥创意。我的方法是将 svg 作为绘图表面,驻留在必须连接的 div 下,然后在其上绘制连接线。
-
每个 div 都来自 ng-repeat 数据。所以我首先需要将它转换为 SVG 以使其能够绘制?帆布怎么样?有可能吗?如果可以,那就更好了。
-
如果你能告诉我如何使用 SVG 或画布来实现它......我真的很感激。
标签: javascript html css angularjs