I have the following problem: I have a large tree that has sub-nodes that can be folded and expanded on demand (data in nodes is obtained using AJAX). However, I use jquery.event.drop / drag to create my drag / drop goals.
However, when I add / unfold the goal of changing the purpose of the drop, I need to recount. Here is how I wanted to do this:
function create_drop_targets() { $('li a') .bind('dropstart', function(event) { }) .bind('drop', function(event) { }) .bind('dropend', function(event) { }); }
create_drop_targets () is called by drop / expand.
However, this does not work. I found the following in jquery.event.drop:
var drop = $.event.special.drop = { setup: function(){ drop.$elements = drop.$elements.add( this ); drop.data[ drop.data.length ] = drop.locate( this ); }, locate: function( elem ){
Now I need to know how I can call the setup () method again so that it refills $ elements with new positions for droppables.
source share