2012-12-19 75 views
8

我想使用librairy jsPlumb Javascript來創建一個帶有兩個div的雙鍵。我可以建立聯繫,但不是雙重債券。JSplumb雙鍵

你知道如何製作雙鍵嗎?

兩年DIV之間的簡單鏈接:兩個DIV

jsPlumb.ready(function() { 
    jsPlumb.importDefaults({ 
     ConnectorZIndex:5 
    }); 
    var jsP = jsPlumb.getInstance({ 
     PaintStyle:{ lineWidth:2, strokeStyle:"#000", outlineColor:"black", outlineWidth:1 }, 
     Connector: "Straight", 
     Endpoint: "Blank" 
    }); 
    var e0 = jsP.addEndpoint("firstLink", { 
      anchor: ["Center"] 
    }); 
    var e1 = jsP.addEndpoint("lastLink", { 
      anchor: ["Center"] 
    }); 
    jsP.connect({ source:e0, target:e1}); 

對於雙鏈接,我對此進行測試,但它不工作:

 var e0 = jsP.addEndpoint("firstLink", { 
      anchor: ["Center"] 
     }); 
     var e1 = jsP.addEndpoint("lastLink", { 
      anchor: ["Center"] 

     }); 
     var e2 = jsP.addEndpoint("firstLink", { 
      anchor: ["Center"] 
     }); 
     var e3 = jsP.addEndpoint("lastLink", { 
      anchor: ["Left"] 

     }); 
     jsP.connect({ source:e0, target:e1}); 
     jsP.connect({ source:e2, target:e3}); 

有人有解決方案嗎?

回答

1

「Left」不是jsPlumb中的有效錨點位置。嘗試「LeftMiddle」,「TopLeft」或「BottomLeft」。 「LeftMiddle」可能是你正在尋找的那個。

+0

這幾乎是我想要的。鏈接之間的間隔更大。我可以確定間距嗎?例如,兩個連接之間5px? –