문제

jQuery 라이브 바인딩을 사용하여 클릭 이벤트를 이미지에 바인딩하고 있습니다. 처음 이미지를 클릭하면 Simplemodal Popup이 시작되고 Draggable이 잘 작동합니다. 그 후, 단순 모달 팝업이 여전히 시작되고 드래그 가능한 항목이 드래그하지 않습니다. 어떤 아이디어?

라이브 코드 클릭 이벤트 :

$("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();
        }
    });
});
도움이 되었습니까?

해결책

누구나 미래에 이것을 찾는 경우 솔루션은 "Draggable"코드를 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(); 
        } 
    }); 
}); 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top