当线路连接的div悬停时,如何触发悬停事件?
在我的例子中,我希望无论何时源或目标都将其变为红色:
我还想更改源和目标的背景颜色。
jsPlumb.ready(function() {
var instance = jsPlumb.getInstance();
jQuery.each(edges, function (index, edge) {
console.log("Connecting: " + edge.source + " to: " + edge.target);
jsPlumb.connect({ source:edge.source, target:edge.target, paintStyle: blue_line, hoverPaintStyle: red_line });
});
});
答案 0 :(得分:0)
这是我提出的解决方案,并不是我想要的,但确实有效:
jsPlumb.ready(function() {
var instance = jsPlumb.getInstance();
jQuery.each(edges, function (index, edge) {
console.log("Connecting: " + edge.source + " to: " + edge.target);
jsPlumb.connect({ source:edge.source, target:edge.target });
jQuery("#" + edge.source + ", #" + edge.target).mouseover(function() {
jQuery("#" + edge.source).addClass("jsplumb-source-hover");
jQuery("#" + edge.target).addClass("jsplumb-target-hover");
}).mouseout(function() {
jQuery("#" + edge.source).removeClass("jsplumb-source-hover");
jQuery("#" + edge.target).removeClass("jsplumb-target-hover");
});
});
});