2012-07-18 115 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

我不能相信这是一个问题他们的代码。他们的样品工作正常。

我错过了一些明显的东西吗?

回答