2017-01-06 35 views
1

我一直在試圖建立一個div使用jQuery的對話框彈出jQuery的對話框需要點擊兩次關閉

首先,當按鈕用戶點擊並打開對話框,然後當他關閉它在關閉對話框第一次點擊。

,當他試圖關閉它會再次打開相同的彈出的對話框中,他需要再次點擊關閉按鈕把它關閉的第二次。

https://jsfiddle.net/xwpwku1w/31/

的jQuery:

function ShowMyContainerDivForSC(containerID, title, width, height) { 
    if ($(containerID).data('uiDialog')) 
     $(containerID).dialog('destroy'); 
    $(containerID).dialog({ 
     width: width, 
     draggable: true, 
     height: height, 
     resizable: false, 
     title: title, 
     modal: false, 
     open: function (event, ui) { 
      $(this).show(); 
     }, 
     close: function (event) { 
      if (typeof AfterClose == "function") { 
       AfterClose(containerID); 
      } 
      //$(this).remove();-- commented cause it just removes the element. 
     } 
    }); 
    return false; 
} 
+0

您可以創建一個的jsfiddle? –

+0

你是從哪裏複製粘貼的? > – Phix

+0

從此,我試圖添加的jQuery。但不工作 - http://jsfiddle.net/AvF8V – pvaju896

回答