JQuery Modal Dialog在Chrome,IE,Safari中增加了一倍。 忽略maxHeight

这是问题的截图(在IE中):

http://img401.imageshack.us/img401/7580/screenield.jpg

上述效果 – 对话窗口的高度加倍,内容(JW播放器)被推到底部 – 发生在IE8,Safari和Chrome中。 在IE9中窗口根本不启动。 在FF中没有问题。

我使用的是带有UI版本1.8.18的JQuery 1.7.1,以及对话框的默认打包CSS。 我试过不指定高度,然后指定maxHeight,两者都无济于事。

启动对话框的完整代码如下所示。 它包含许多可能是多​​余的细节问题,但基本上是创建与动态内容启动对话的链接。 精确的模态设置在最后。

所有帮助赞赏。

$(document).ready(function(){ var num = 0; //Find [popup] instances, increment the number $("li:contains('[popup]')").each(function() { var nextnumber = num++; //add a general and a unique class to the list item containing the hook $(this).addClass('popup' + ' ' + 'pop' + nextnumber); //Split on the hook, and save remainder of text (the path to file) as the 'path' attr var splitpath = $(this).text().split("[popup]"); $(this).attr("path", splitpath[1]); var path = $(this).attr("path"); //alert($(this).attr("path")); //Get the previous list item (the call to action), and give it general and unique classes also. $thisArrow = $(this).parent().prev(); $thisArrow.addClass('arrow' + ' ' + 'arr' + nextnumber); //Make the call to action an anchor link, with a general class identifier. $thisArrow.wrapInner(''); //store path to poster as var, and hide the .popup li's $('li.popup').parent().hide(); }); $('.opener').click(function() { var Header = $(this).text(); var popupURL = $(this).attr("path"); var popupBG = "../contents/css/images/white-nontrans.jpg"; var thisDialog = $('
').html('') .append('') .append('') .append('') .append('') .append('') .append('') .append('') .append('') .append('') .dialog({ autoOpen: false, title: Header, modal: true, maxHeight: 500, width:580 }); thisDialog.dialog('open'); return false; }); });

您同时添加了元素,因此对话框实际上包含2个玩家。 但是第一个( )被破坏了。 启动的JavaScript

 var thisDialog = $('
').html(...

正在添加 ,jQuery会在添加子元素之前自动关闭元素。 因此,附加内容将写入父

您可能希望使用具体取决于页面呈现的浏览器。 我将查看JW Player的文档,详细解释如何使用其中一个。