Programatically “picking up” connections between elements in jsPlumb jQuery


Screen Shot 2015-01-03 at 10.34.35 AM
source code is here

$(function() {

    
    jsPlumb.ready(function() {
       var jsp = jsPlumb.getInstance();
        jsp.draggable($("#start"));
        jsp.draggable($("#end"));
        
        var endpoint = jsp.addEndpoint($("#start"), {
            isSource:true
        });
        
        jsp.addEndpoint($("#end"), {
            isTarget:true
        }); 
        
        $("#dragbutton").bind("mousedown", function(e) {
            
            $(document).bind("mousemove.adjust", function(e) {
                
                var left = e.offsetX;
                var top = e.offsetY;
                $(endpoint.canvas).css({"left":left, "top":top});
                $(document).unbind("mousemove.adjust");
            });
            
            $(endpoint.canvas).trigger(e)
        })
        
        
    })
    
   
    
})


Leave a Reply