【发布时间】:2015-07-16 08:19:30
【问题描述】:
我是 jsPlumb 的新手,我正在使用 demos。指定目标或源时,我不需要允许连接。我的意思是:当目标是 X - 无法建立连接。
【问题讨论】:
-
你能创造一个小提琴来玩吗?
标签: jsplumb
我是 jsPlumb 的新手,我正在使用 demos。指定目标或源时,我不需要允许连接。我的意思是:当目标是 X - 无法建立连接。
【问题讨论】:
标签: jsplumb
jsPlumb 在建立连接时触发事件connection。
jsPlumb.bind("connection", function(info) {
if(info.sourceId==='abc'){
jsPlumb.detach(info.connection);
}
});
info 是一个具有以下属性的对象:
connection - the new Connection. you can register listeners on this etc.
sourceId - id of the source element in the Connection
targetId - id of the target element in the Connection
source - the source element in the Connection
target - the target element in the Connection
sourceEndpoint - the source Endpoint in the Connection
targetEndpoint - the targetEndpoint in the Connection
参考资料:
http://www.jsplumb.org/doc/events.html#evt-connection-detached http://www.jsplumb.org/doc/removing.html http://www.jsplumb.org/apidocs/classes/jsPlumb.html#method_detach
【讨论】:
tick接受它作为答案