0
我試圖每次動態創建新的HTML元素時調用EasyUI的draggable
。我附上像這樣的draggable
方法:EasyUI:draggable()在被調用時不初始化
function initializedrag() {
console.log("initializedrag called")
$(".item").draggable({
revert:true,
proxy:'clone',
onStartDrag:function(){
$(this).draggable('options').cursor = "not-allowed";
$(this).draggable('proxy').css('z-index',3);
},
onStopDrag:function(){
$(this).draggable('options').cursor="move";
}
});
console.log("end of initializedrag")
}
,而且我用load
中包含一個div一些li
項目,有一類.item
,像這樣,當a
標籤一個新的HTML網站的加載頁面已準備就緒:
$(function() {
console.log("ready");
$("#shop").load("shopcontent/cat1.html");
initializedrag();
...
});
通過console.logs,它調用的功能正常,但是,拖拽功能不實際工作。當我有一個已經在頁面上的元素時,draggable
完全相同,在頁面加載時有draggable
。但是,每當我撥打initializedrag
函數時,我都需要它。
這是怎麼回事?