2015-10-12 147 views
0

當線路連接的div懸停時,如何觸發懸停事件?jsPlumb工具包觸發懸停事件

在我的例子,我想行變爲紅色,只要源或目標的div他徘徊:

http://jsfiddle.net/rt9pkLp3/

我也想改變這兩種來源的背景顏色和目標。

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

這是我想出瞭解決的辦法是不正是我想要的,但沒有工作:

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"); 
     }); 
    }); 
});