真的只是在寻找想法。我想要的是当两个带有图像的 div 彼此靠近时,移动它们的位置以相互连接。任何想法如何做到这一点?
HTML
<body onkeyup="clearPress()" onkeydown="controlCheck(event)" style="cursor: auto;">
<div id="application" style="position:absolute">
<div id="accordion" class="ui-accordion ui-widget ui-helper-reset" style="position:absolute;top:0px;left:0px;width:300px;height:900px" role="tablist"> … </div>
<div id="buttons" style="position:absolute;top:0px;left:315px;width:1100px;height:50px;border:2px solid grey;background: url('images/ui-bg_glass_75_e6e6e6_1x400.png') repeat-x scroll 50% 50% rgb(230, 230, 230);"> … </div>
<div id="canvas" class="DROPPABLE ui-droppable" style="position:absolute;top:50px;left:315px;width:1100px;height:850px;border:2px solid grey">
<div class="DRAGGABLE ui-draggable" style="position: absolute; width: 120px; height: 60px; top: 123.817px; left: 507.7px;" onclick="addBorder(this)">
<img id="PMF00" src="/devices/AAU01-010.gif"></img>
</div>
<div class="DRAGGABLE ui-draggable" style="position: absolute; width: 42px; height: 42px; top: 988.7px; left: -344.3px;" onclick="addBorder(this)"> … </div>
<div class="DRAGGABLE ui-draggable" style="position: absolute; width: 84px; height: 36px; top: 138.7px; left: 412.467px;" onclick="addBorder(this)"> … </div>
<div class="DRAGGABLE ui-draggable" style="position: absolute; width: 80px; height: 41px; top: 143.7px; left: 151.7px;" onclick="addBorder(this)"> … </div>
<div class="DRAGGABLE ui-draggable" style="position: absolute; width: 100px; height: 100px; top: 92px; left: 344px;" onclick="addBorder(this)"> … </div>
</div>
</div>