I am trying to combine bind and dragable
$(".qq-upload-success").draggable({//functions});
have some one a solution?
I load th开发者_开发问答is class with ajax. So this function doesn't work, so I have to bind() or live() this action to this class.
$(".qq-upload-success").bind("draggable", function() {
$.draggable({
helper:'clone',
start: function(event, ui) {
var txta = $("textarea#kapiteltext");
$("div#pseudodroppable").css({
position:"absolute",
top:txta.position().top,
left:txta.position().left,
width:txta.width(),
height:txta.height()
}).droppable(options).show();
},
stop: function(event, ui) {
$("div#pseudodroppable").droppable('destroy').hide();
}
});
});
or
$(".qq-upload-success").bind("drag", draggable({
helper:'clone',
start: function(event, ui) {
var txta = $("textarea#kapiteltext");
$("div#pseudodroppable").css({
position:"absolute",
top:txta.position().top,
left:txta.position().left,
width:txta.width(),
height:txta.height()
}).droppable(options).show();
},
stop: function(event, ui) {
$("div#pseudodroppable").droppable('destroy').hide();
}
}));
thank you!
It is not possible to add non-event things (e.g. draggable) for all elements created in the future.
You need to create it when the element exists, e.g. by using $('.foo:not(.ui-draggable)').draggable(...)
whenever such an element gets added.
精彩评论