嗨,我目前正在使用它,我想这肯定会对您有所帮助。
jsPlumb.ready(function(){
ShowStartNode() ;
});
function ShowStartNode(){
var newState = $('<div>').attr('id', 'start').addClass('item');
var title = $('<div>').addClass('title').text('Start');
var connect = $('<div>').addClass('connect');
newState.css({
'top': '80px',
'left': '500px'
});
jsPlumb.makeTarget(newState, {
anchor: 'Continuous',
connector:[ "Flowchart" ]
});
jsPlumb.makeSource(connect, {
parent: newState,
anchor: 'Continuous',
connector:[ "Flowchart" ]
});
newState.append(title);
newState.append(connect);
$('#centerdiv').append(newState);
jsPlumb.draggable(newState, {
containment: '#centerdiv'
});
newState.dblclick(function(e) {
jsPlumb.detachAllConnections($(this));
$(this).remove();
e.stopPropagation();
});
}