2014-03-18 2 views
2

상자 내 목록에 카드를 추가 할 때 두 번 클릭하면 대화 상자를 열 수 있습니다. 그것은 잘 작동합니다. 카드를 드래그하여 Onhold 목록에 놓으면 문제가 발생합니다. 대화 상자를 열려면 두 번 클릭했지만 성공하지 못했습니다. 해결책에 대한 의견이 있으십니까?두 번 클릭 할 때 열린 대화 상자의 문제점

Demo

HTML :

<!--Wrapper div--> 
    <div id="wrapper"> 
     <div id="onHoldList" class="cellContainer"> 
      <p>On Hold</p> 
     </div> 
     <!--Inbox list and button to add a card--> 
     <div id="inboxList" class="cellContainer"> 
      <p style="display: inline">Inbox</p> 
      <!--Button to add a Card--> 
      <input type="button" id="AddCardBtn" value="+ Add a Card..."/> <hr class="fancy-line"/> <br/> 

      <!--Card div--> 
      <div id="userAddedCard"> <br/> 
       <div> 

       </div> 
      </div> 
     </div> 


    </div> 
    <!--Modal Dialog--> 
    <div id="modalDialog"> 

     <form> 
      <label>Title</label> 
      <input type="text" id="customTextBox" value="some value"/> 
      <p>Date: <input type="text" id="datepicker" value="some date"/></p> 
      <input type="button" id="Getbtn" value="Get value"/> <hr/><br/> 


     </form> 

    </div> 

JQuery와 : 사업부 목록이 더 이상 #userAddedCard의 아이가 아닌 보류 상태로 이동

$(function() { 
    // Click function to add a card 
    var $div = $('<div />').addClass('sortable-div'); 
    $('<label>Title</label><br/>').appendTo($div);    
    $('<input/>', { "type": "text","class":"ctb"}).appendTo($div); 
    $('<input/>', { "type": "text","class":"date"}).appendTo($div); 
    var cnt =0,$currentTarget; 
    $('#AddCardBtn').click(function() { 
     var $newDiv = $div.clone(true); 
     cnt++; 
     $newDiv.prop("id","div"+cnt); 
     $('#userAddedCard').append($newDiv); 
//  alert($('#userAddedCard').find("div.sortable-div").length);   
    }); 

    // Double click to open Modal Dialog Window 
    $('#userAddedCard').dblclick(function (e) { 
     $currentTarget = $(e.target); 

     $('#modalDialog').dialog({ 
      modal: true, 
      height: 600, 
      width: 500, 
      position: 'center' 
     }); 
     return false; 

    }); 
    $("#datepicker").datepicker({showWeek:true, firstDay:1}); 

    $("#Getbtn").on("click",function() { 
     var val = $("#customTextBox").val(); 
     $currentTarget.find(".ctb").val(val); 
     $currentTarget.find(".date").val($("#datepicker").val()); 
     $('#modalDialog').dialog("close"); 
    }); 

    // Sortable cards 
    $('.cellContainer').sortable({ 
     items: '.sortable-div', 
     containment: 'document', 
     cursor: 'crosshair', 
     opacity: '0.70', 
     connectWith: '.cellContainer', 

    }).disableSelection(); 
}); 

답변

3

.

$('#wrapper').on('dblclick', '.sortable-div', function (e) { 
+0

그래로 변경

$('#userAddedCard').dblclick(function (e) { 

, 당신 말이 맞아 표시, 당황 사실은 그것을 놓쳤다. – deweyredman

+0

고맙습니다. 그것은 잘 작동합니다 :) – AdiT

관련 문제