问题描述
我似乎无法弄清为什么我的jsplumb无法正常工作。我创建了一个非常简单的sippet示例(随附于这篇文章)。
I can't seem to work out why my jsplumb is not working. I have created a very simple sippet example (attached to this post).
jsPlumb.ready(function() {
jsPlumb.draggable($('.square'))
jsPlumb.connect({
source: "element1",
target: "element2"
});
});
.square {
background-color: red;
width: 50px;
height: 50px;
position: absolute;
}
<body>
<h1>Hello World!</h1>
<div id="element1" class="square"></div>
<div id="element2" class="square" style="left:300px"></div>
<script data-require="jquery@*" data-semver="2.1.4" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script data-require="jsplumb@*" data-semver="1.7.2" src="https://cdnjs.cloudflare.com/ajax/libs/jsPlumb/1.4.1/jquery.jsPlumb-1.4.1-all-min.js"></script>
</body>
我已将在CSS中的位置设置为绝对,但我为为什么无法正常工作而感到困惑。我将其与工作示例进行比较,并没有成功阅读文档。
I have set my positioning in the css to absolute but I'm stumped as to why I can't get it working. I compared it to working examples and read through the documentation with no success.
对此,我将不胜感激。
我要去哪里错了?
推荐答案
尝试使用
elementsList = jsPlumb.getSelector('。广场');
jsPlumb.draggable(elementsList);
elementsList = jsPlumb.getSelector('.square');jsPlumb.draggable(elementsList );
else直接给元素
jsPlumb.draggable($(’#element1’));
jsPlumb.draggable($(’#element2'));
else directly give elementsjsPlumb.draggable( $('#element1'));jsPlumb.draggable( $('#element2'));
这篇关于jsplumb可拖动不起作用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!