IE7 在调整窗口大小时无法正确定位对话框
就像我说的,IE7(和 IE6,但我不太关心 IE6)在窗口大小调整时无法正确定位对话框。当调整窗口大小时,对话框会不断向下移动。 IE8 FF Chrome Safari 都可以正常工作,位置和调整对话框大小都很好,但 IE7 可以调整对话框大小,但位置不正确。有人知道这个问题的一些解决办法吗?
$("#mydialog").dialog({
autoOpen: false,
bgiframe: true,
resizable: false,
modal: true,
title: "",
height: 400,
overlay: {
backgroundColor: '#000',
opacity: 0.5
}
});
$(window).resize(function(){
$('#mydialog').dialog("option", "height", $(window).height() - 40);
$('#mydialog').dialog('option', 'position', 'center');
});
$("#mydialog").dialog("open");
Like I said, IE7 (and IE6 but I don't really care IE6 that much) doesn't position dialog properly on window resize. When window is re sized, dialog goes down and down. IE8 FF Chrome Safari all work properly and position and re size dialog just fine but IE7 it re sizes the dialog but positions incorrectly. Anybody know some fix about this?
$("#mydialog").dialog({
autoOpen: false,
bgiframe: true,
resizable: false,
modal: true,
title: "",
height: 400,
overlay: {
backgroundColor: '#000',
opacity: 0.5
}
});
$(window).resize(function(){
$('#mydialog').dialog("option", "height", $(window).height() - 40);
$('#mydialog').dialog('option', 'position', 'center');
});
$("#mydialog").dialog("open");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,这是我发现的一个解决方法,它有点慢,但它有效。
Ok here is a workaround I found, it's a bit slow but it works.
我最近遇到了这个问题,发现了一个针对 IE7 的更快、更合适的修复方法,只需将 body 的 css 属性设置为relative,考虑到 IE7 处理 window 对象的方式。
由于您使用的是 jQuery,因此以下内容应该有效:
我还创建了以下内容来说明问题和解决方案: http:// /jsfiddle.net/ewsang/7PpcV/
I ran into this recently and discovered a faster and more appropriate fix for IE7, simply set the body's css property to relative, accounting for the way IE7 handles the window object.
Since you are using jQuery, the following should work:
I also created the following to illustrate the issue and solution: http://jsfiddle.net/ewsang/7PpcV/