I have this script, which to display window on screen:
$.ajax({
type: "POST",
url: "test.php",
data: dataString,
cache: false,
success: function(html){
$("#work-window").append(html);
}
});
This window:
<div id="div-add" class="window">
<table cellspacing="0" cellpadding="0" class="top-bar">
<td class="left"></td>
<td cla开发者_开发知识库ss="center">Add</td>
<td class="close"> <span id="develop-link-close">close</span></td>
<td class="right"></td>
</table>
Content
</div>
I need to do, that when click a center class, i can drag and drop this div (#div-add).
i tried make it with jquery Ul, but no result :(
$(function() {
$( "#div-add" ).draggable();
});
How create this ?
Posting it as an answer here in case it helps anyone else
You're probably making the .draggable()
call in your page before #div-add
actually exists. Since #div-add
exists only after the ajax call, you need to make the $( "#div-add" ).draggable();
call once your AJAX call has completed.
精彩评论