changed the way drag and drop events are binding to nodes to fix an issue in recent versions of FF. Also cleaned out some dead code

master
Wes 2011-12-02 13:41:02 +00:00
parent fa3bc92c87
commit b39c765332
3 changed files with 23 additions and 35 deletions

View File

@ -9,8 +9,8 @@
<script type="text/javascript" src="prettify.js"></script>
<!-- jQuery includes -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script src="jquery.jOrgChart.js"></script>

View File

@ -41,38 +41,35 @@
revertDuration : 100,
snap : 'div.node.expanded',
snapMode : 'inner',
stack : 'div.node',
start : handleDragStart,
stop : handleDragStop
stack : 'div.node'
});
$('div.node').droppable({
accept : '.node',
activeClass : 'drag-active',
drop : handleDropEvent,
hoverClass : 'drop-hover'
});
// Drag start event handler for nodes
function handleDragStart( event, ui ){
$('div.node').bind("dragstart", function handleDragStart( event, ui ){
var sourceNode = $(this);
sourceNode.parentsUntil('.node-container')
.find('*')
.filter('.node')
.droppable('disable');
}
});
// Drag stop event handler for nodes
function handleDragStop( event, ui ){
$('div.node').bind("dragstop", function handleDragStop( event, ui ){
/* reload the plugin */
$(opts.chartElement).children().remove();
$this.jOrgChart(opts);
}
});
// Drop event handler for nodes
function handleDropEvent( event, ui ) {
$('div.node').bind("drop", function handleDropEvent( event, ui ) {
var sourceNode = ui.draggable;
var targetNode = $(this);
@ -113,7 +110,7 @@
targetLi.append('<ul><li>'+sourceliClone.html()+'</li></ul>');
}
} // handleDropEvent
}); // handleDropEvent
} // Drag and drop
};
@ -148,10 +145,7 @@
.end()
.html();
//var $heading = $("<h2>").text(nodeContent);
$nodeDiv = $("<div>").addClass("node").append($nodeContent);
// $nodeDiv.data('markup',$node.html());
// Expand and contract nodes
$nodeDiv.click(function() {

View File

@ -41,38 +41,35 @@
revertDuration : 100,
snap : 'div.node.expanded',
snapMode : 'inner',
stack : 'div.node',
start : handleDragStart,
stop : handleDragStop
stack : 'div.node'
});
$('div.node').droppable({
accept : '.node',
activeClass : 'drag-active',
drop : handleDropEvent,
hoverClass : 'drop-hover'
});
// Drag start event handler for nodes
function handleDragStart( event, ui ){
$('div.node').bind("dragstart", function handleDragStart( event, ui ){
var sourceNode = $(this);
sourceNode.parentsUntil('.node-container')
.find('*')
.filter('.node')
.droppable('disable');
}
});
// Drag stop event handler for nodes
function handleDragStop( event, ui ){
$('div.node').bind("dragstop", function handleDragStop( event, ui ){
/* reload the plugin */
$(opts.chartElement).children().remove();
$this.jOrgChart(opts);
}
});
// Drop event handler for nodes
function handleDropEvent( event, ui ) {
$('div.node').bind("drop", function handleDropEvent( event, ui ) {
var sourceNode = ui.draggable;
var targetNode = $(this);
@ -113,7 +110,7 @@
targetLi.append('<ul><li>'+sourceliClone.html()+'</li></ul>');
}
} // handleDropEvent
}); // handleDropEvent
} // Drag and drop
};
@ -148,10 +145,7 @@
.end()
.html();
//var $heading = $("<h2>").text(nodeContent);
$nodeDiv = $("<div>").addClass("node").append($nodeContent);
// $nodeDiv.data('markup',$node.html());
// Expand and contract nodes
$nodeDiv.click(function() {