Jquery Live and Draggable

我使用Jquery Live绑定将click事件绑定到图像。 我第一次点击图像时,simplemodal弹出窗口启动和拖动工作正常。 之后,simplemodal弹出窗口仍然启动,拖动项目不会拖动。 有任何想法吗?

实时点击事件代码:

$("table tr td img:not(.Help)").live("click", function(){ $("#draggable").draggable({ containment: 'parent', drag: function(e, ui){ alert("dragging"); } }); $("#modal").modal({ onShow: function(){ $("html").css("overflow", "hidden"); }, onClose: function(){ $("html").css("overflow", "auto"); $("table tr td img").live("click", function(){}); $.modal.close(); } }); }); 

如果有人在将来寻找这个,解决方案是将“可拖动”代码放在onShow回调中。

 $("table tr td img:not(.Help)").live("click", function(){ $("#modal").modal({ onShow: function(){ $("#draggable").draggable({ containment: 'parent', drag: function(e, ui){ alert("dragging"); } }); $("html").css("overflow", "hidden"); }, onClose: function(){ $("html").css("overflow", "auto"); $("table tr td img").live("click", function(){}); $.modal.close(); } }); });