2010-10-13 23 views
1

因此,这里是我的HTML:jQuery UI的对话框搞砸了,如果HTML里面

<a href="#/" class="next openModalBox lessOpacity">Posunúť sa dopredu</a> 
<div id="modalBoxContent"> 
    <p style="font-size: .8em; text-align: center;"> 
    Úspešne ste absolvovali študijnú časť školenia. 
     Pre ukončenie školenia je potrebné úspešne absolvovať <a href="/index/index" class="accessible-link">záverečný test</a>. 
</p> 
</div> 

而我的JS:

$(document).ready(function() { 

    // vytvorenie kurzu 
    $('a.openModalBox').click(function(e) { 
     var href = $(this).attr('href'); 
     if ('#/' == href) { 
      e.preventDefault(); 
      $('#modalBoxContent').dialog({ 
       modal: true, 
       resizable: false, 
       title: 'Upozornenie', 
       zIndex: 1, 
       show: 'fast', 
       hide: 'slow', 
       width: 600, 
       height: 90, 
       position: 'middle' 
      }).width(600); 
     } 
    }); 

}); 

问题是对话窗口被搞砸了。这是它的HTML:

<div style="width: 1920px; height: 862px; z-index: 2;" class="ui-widget-overlay"></div> 
<div aria-labelledby="ui-dialog-title-modalBoxContent" role="dialog" tabindex="-1" class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable" style="display: block; z-index: 3; outline: 0px none; height: auto; width: 600px; top: 381px; left: 655px;"> 
<div style="-moz-user-select: none;" unselectable="on" class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"> 
<span style="-moz-user-select: none;" unselectable="on" id="ui-dialog-title-modalBoxContent" class="ui-dialog-title">Upozornenie</span> 
<a style="-moz-user-select: none;" unselectable="on" role="button" class="ui-dialog-titlebar-close ui-corner-all" href="#"><span style="-moz-user-select: none;" unselectable="on" class="ui-icon ui-icon-closethick">close</span></a> 
</div> 
<div class="ui-dialog-content ui-widget-content" style="display: block; width: 600px; min-height: 0px; height: 36px;" id="modalBoxContent"> 
        <p style="font-size: 0.8em; text-align: center;"> 
         Úspešne ste absolvovali študijnú časť školenia. 
Pre ukončenie školenia je potrebné úspešne absolvovať <a href="/index/index" class="accessible-link">záverečný test</a>. 
        </p> 

</div></div> 

它看起来像这样:

http://i51.tinypic.com/2ai4oro.jpg

当只是一个文本的#modalBoxContent内,对话窗口看起来它应该是。只有当有一些HTML时,它看起来很乱。

回答

2

你有什么作品,you can test it here。确保你的HTML是有效的,并且没有任何未封闭/无效的标签,也要确保你的CSS不会干扰(这可能是原因)。试试而不是包括你自己的样式表(但仍包括jQuery UI版本),看看它是否能解决问题。