2012-07-18 112 views
0

我碰到這個非常漂亮的jQuery的運行時負載顯示/自舉模式的插件:對話框使用對話框2的模式插件

http://nikku.github.com/jquery-bootstrap-scripting/

然而,在試圖讓最簡單的例子來上班,我跑進一個問題

從他們的網站複製我的對話框時,第一次加載頁面時顯示。

HTML:

<a class="open-dialog" rel="sample1-dialog">trigger</a> 

<div id="sample1-dialog" style="display: none"> 
    <h1>Simple alert</h1> 
    <p> 
     It is always beneficial to acknowledge alerts of any kind. 
     You can close this alert if you agree. 
     (Note: Normally a dialog box is not that penetrating) 
    </p> 
    <div class="form-actions"> 
     <button class="btn-primary close-dialog">Understood</button> 
     <button class="btn-danger" onclick="alert('You might reconsider your click behaviour!')">I don't care</button> 
    </div> 
</div> 

的jQuery:

$(function() { 
     $("#sample1-dialog").dialog2({ 
      showCloseHandle: false, 
      removeOnClose: false, 
      autoOpen: false, 
      closeOnEscape: true, 
      closeOnOverlayClick: true 
     }); 

     $(".open-dialog").click(function (event) { 
      event.preventDefault(); 
      $("#sample1-dialog").dialog2("open"); 
     }); 

這裏有一個小提琴,顯示問題:

fiddle

我不能相信這是一個問題他們的代碼。他們的樣品工作正常。

我錯過了一些明顯的東西嗎?

回答