jquery.event.drop-2.0 with jquery 1.7+ ?

Skoðað 205 sinnum
Fara í fyrstu ólesnu skilaboð

Steve

ólesið,
26. feb. 2012, 05:08:4626.2.2012
til threed...@googlegroups.com
Hey,

I'm currently using this great library with jquery 1.7.1.
Everything seems to be working fine except for when you try using the plugin with "on".
My problem is that my application has dynamically added content which has to be draggable.

In my case this code doesn't work. If I change "live" to "on" it works, but it attaches only to the current elements and the newly added ones are not draggable.

Is there a patch that can fix this problem?

Steve

xdamman

ólesið,
6. mar. 2012, 14:14:576.3.2012
til threedubmedia
Also running into this issue.
I found this https://groups.google.com/forum/#!topic/threedubmedia/94yO2u0TxMc/discussion
but it doesn't solve all my problems. Maybe it can help.

Is the original author of the jquery.event.drag library still alive
and maintaining this library?


On Feb 26, 2:08 am, Steve <ad...@itnews-bg.com> wrote:
> Hey,
>
> I'm currently using this great library with jquery 1.7.1.
> Everything seems to be working fine except for when you try using the
> plugin with "on".
> My problem is that my application has dynamically added content which has
> to be draggable.
>
> In my case this <http://threedubmedia.com/code/event/drop/demo/live> code

Сергей Колоней

ólesið,
14. mar. 2012, 12:50:1114.3.2012
til threedubmedia
Seems like there was several changes in jquery 1.7 related to inner
representation of live events, so plugin's code which dealt with them
appeared to be incorrect.

I've fixed this issue by rewriting half of code inside plugin's
delegate() function:

// identify potential delegate elements
delegate: function( event ){
// local refs
var elems = [], target,
// element event structure
events = $.data( this, "events" ) || {},
key, i, liver;

// query live events

for (key in events) {

if (key.indexOf("drag") !== 0)
continue;

liver = events[key];
for (i=0; i<liver.length; i++) {
target = $( event.target ).closest( liver[i].selector,
event.currentTarget )[0];

if ( !target )
continue;

$event.add( target, liver[i].origType+'.'+drag.livekey,
liver[i].origHandler || liver[i].handler, liver[i].data );
// remember new elements
if ( $.inArray( target, elems ) < 0 )
elems.push( target );
}
}

// if there are no elements, break
if ( !elems.length )
return false;
// return the matched results, and clenup when complete
return $( elems ).bind("dragend."+ drag.livekey, function(){
$event.remove( this, "."+ drag.livekey ); // cleanup delegation
});
},

I hope it helps :)
It's a pity, but it seems that this plugin isn't maintained.
Skilaboðum hefur verið eytt

Steve

ólesið,
16. maí 2012, 12:12:1516.5.2012
til threed...@googlegroups.com
I can confirm this seems to fix the problem!

Благодаря Сергей, поздрави от България!
Svara öllum
Svara höfundi
Senda áfram
0 ný skilaboð