我绑定点击事件来使用jQuery实时结合的图像。我第一次在图像上单击simplemodal弹出发射和拖动工作正常。在此之后,simplemodal弹出仍会启动和可拖动的项目将不会拖累。任何想法?

现场Click事件的代码:

$("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();
        }
    });
});
有帮助吗?

解决方案

在任何情况下,查找此在以后的解决办法是把“拖动”代码在昂秀回调。

$("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(); 
        } 
    }); 
}); 
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top