我有一些 div 元素,每个元素有 2 个端点(一个在左侧,一个在右侧)。
现在我想删除每个右侧端点。
每个端点都有自己唯一的 uuid。
我得到了右侧端点的每个 uuid 的数组 -> 遍历它们并删除其中的每一个,但这不起作用
谁能给我一个通过 uuid 或对象删除端点的工作示例?
就我而言,两者都不起作用。我每次都会收到此错误消息:
类型错误:o 未定义
jquery.jsPlumb-1.4.1-all.js
681路
$(elementArray).each(function(){
//the uuid
var currentUuid = 'rightEndpoint_'+this;
//the endpoint object -> that acutually works
var getCurrentEndpoint = jsPlumb.getEndpoint(currentUuid);
//delete the endpoint -> here I got the error message
jsPlumb.deleteEndpoint(currentUuid);
});
提前致谢!
var that=$('div'); //get all of your DIV tags having endpoints
for (var i=0;i<that.length;i++) {
var endpoints = jsPlumb.getEndpoints($(that[i])); //get all endpoints of that DIV
for (var m=0;m<endpoints.length;m++) {
if(endpoints[m].anchor.type=="Right") //Endpoint on right side
jsPlumb.deleteEndpoint(endpoints[m]); //remove endpoint
}
}
通过使用上面的代码,将不需要存储端点 uuid。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)