2011-11-18 61 views
0

我有一個div元素定義爲:SimpleModal崩潰時調用close模式

$("#searchDialog").modal({ opacity: 70, 
          overlayCss: { backgroundColor: "Black" }, 
          overlayClose: false 
          }); 

<div id="searchDialog" class="searchDialog">...</div> 

在我的代碼,我使用的代碼塊打開DIV作爲一個模式對話框當我嘗試使用此代碼關閉對話框:

$.modal.close(); 

我得到一個運行時錯誤:

Microsoft JScript runtime error: Unable to get value of the property 'remove': object is null or undefined. 

Visual Studio調試器突出顯示語句「a.d.overlay.remove();」在SimpleModal javascript源代碼中。

我使用的是Visual Studio 2010,瀏覽器是IE 9。SimpleModal的版本是1.4。

任何人有任何建議嗎?

Richard

回答

1

SimpleModal庫存在一個錯誤。要修復它在你的對話框中,更改

setTimeout(function(){ 
    // opera work-around 
    s.d.overlay.remove(); 

    // reset the dialog object 
    s.d = {}; 
}, 10); 

setTimeout(function(){ 
    // opera work-around 
    if (s.d.overlay){ 
     s.d.overlay.remove(); 
    } 

    // reset the dialog object 
    s.d = {}; 
}, 10); 

See the SimpleModal bug tracker for details