我正在使用 jQuery UI 对话框在新的 iFrame 中呈现内容。一切都很好,只是对话框的父窗口在显示对话框时获得了水平滚动条(IE8)。我已经将问题追溯到 iFrame 中的 <html> 元素被浏览器解释为非常宽,即使 iFrame 中页面上的唯一内容在 580px div 中也是如此。
我已经尝试将 CSS 添加到 iFrame 中的 HTML 和 BODY 标记(例如宽度:98% 或宽度:600px;)......这些似乎都没有任何影响。
打开对话框的代码如下。有什么建议么?
$("a[providerId]").click(function(e) {
e.preventDefault();
var $this = $(this);
var $width = 600;
var $height = 400;
$('<iframe id="companyDetail" class="companyDetail" style="padding: 0px;" src="' + this.href + '" />').dialog({
title: $this.attr('title'),
autoOpen: true,
width: $width,
height: $height,
modal: true,
resizable: false,
autoResize: true,
overlay: {
opacity: 0.5,
background: "black"
}
}).width($width).height($height);
});
更新:查看我得到代码的这些演示,看看我在说什么(在 IE8 中):http ://elijahmanor.com/demos/jqueryuidialogiframe/index.html