我的实例是这样的:
jsp = jsPlumb.getInstance();
jsp.setContainer(_domnodeId);
jsp.ready(function(){
//doing some stuff - connecting boxes with arrows...
var conn2 = jsp.connect({
source: boxSST_IPMRS_COBRAIP.boxId,
target: boxCOBRA_IM.boxId
});
}
结果:
在另一个函数中我也在做同样的事情:
jsp = jsPlumb.getInstance();
jsp.setContainer(_domnodeId);
jsp.ready(function(){
//var dynamicAnchor = [ [ 0.2,1,0.5 ], [ 0.2, 1, 0.5 ], "Top", "Bottom" ];
var common = {
anchor:[ "Continuous", { faces:["bottom","right"] }],
endpoint: "Blank",
connector:[ "Bezier", { curviness:50 }, common ],
overlays: [
["Arrow", {location:1, width:10, length:10}],
]
};
jsp.connect({
source: boxes.b1.boxId,
target: boxes.b2.boxId
}, common);
}
箭头都向左移动,上 Angular ... var jsp 是全局的,我在第二个函数的开头清除了 _domnodeId。有什么建议吗?
清除我的 domnodeID:
function clean(container){
//remove everything
$("#" + container)
.children()
.not('nav')
.remove();
// box id counter
window.EvmClasses.chartBox.boxId = 0;
}
最佳答案
I cleared _domnodeId at the beginning of my second function
你是怎么做到的?在我看来,您没有正确清除它。
你读过"Removing"吗?手册的一部分?
If you have configured a DOM element with jsPlumb in any way you should use jsPlumb to remove the element from the DOM (as opposed to using something like jQuery's remove function, for example).
请仔细阅读。您可能需要 jsPlumb.empty
、deleteEveryEndpoint
或 reset
。
关于javascript - 不能将 jsplumb 与第二个功能一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34329827/