无法将图像设置为jsPlumb端点

我在我的项目中使用了jsPlumb库,并且我有一个函数可以在连接时更改端点映像。 我在页面加载时调用它,一切正常,但是当我在连接事件上调用它时,没有任何反应。 这是我的代码:

function changeEndpointImage(){ var elem = $('.tableBody'); //These are my connectable elements for(var i=0;i<elem.length;i++) { var eps=jsPlumb.getEndpoints($(elem[i])); //Getting endpoints for each of the connectable elements for(var j=0;j<eps.length;j++) { if(eps[j].connections.length!=0) //Checking if any of them have connections eps[j].setImage("images/styled_radiobutton.png"); //Setting another image } } } jsPlumb.bind("connection", function(connection) { changeEndpointImage(); //I have also tried this method commented below, but nothing. //connection.sourceEndpoint.setImage("images/styled_radiobutton.png"); //connection.targetEndpoint.setImage("images/styled_radiobutton.png"); }); 

如果连接已分离,我也尝试将端点映像更改回第一个外观,但在这种情况下,只有源端点发生更改,目标保持不变:

 jsPlumb.bind("connectionDetached", function(connection) { connection.targetEndpoint.setImage("images/rsz_styled_radiobutton.png"); connection.sourceEndpoint.setImage("images/rsz_styled_radiobutton.png"); }); 

我错过了什么或如何解决这个问题?

编辑:这是jsfiddle:

https://jsfiddle.net/vaxobasilidze/cg3hkde7/

将几个项目拖到右侧div,按“添加新链接”并尝试附加分离连接。 您将看到端点不会更改。

我在jsPlumb谷歌小组找到了解决方案。 我设置了端点Blank而不是Image ,添加了cssClass: 'myClass'属性,然后设置样式.myClass { background: url(...) } 。 这样做我想要的,因为连接的端点获得额外的类'jsplumb-endpoint-connected' ,我可以设置另一个图像作为此类的背景。