简体   繁体   English

jQuery Dialog使滚动条出现在主要内容中

[英]jQuery Dialog makes scrollbars appear in main content

This test of jQuery dialog makes the scrollbars appear in the main content when the dialog is opened. jQuery对话框的这个测试使得在打开对话框时滚动条出现在主要内容中。 When I touch the dialog resize, the scrollbars go away. 当我触摸对话框调整大小时,滚动条会消失。 Is it the way I defined the dialog or too much content? 这是我定义对话框或内容太多的方式吗? Click the [!] in the top right corner to see this. 单击右上角的[!]以查看此内容。 Platform: XPsp3, browsers: FF3.6.3, IE8, Safari 5 Thanks 平台:XPsp3,浏览器:FF3.6.3,IE8,Safari 5谢谢

See here for a couple different ways to approach: Opening a Modal Dialog shows a horizontal scroll bar 请参阅此处了解几种不同的方法: 打开模态对话框显示水平滚动条

Quick CSS fix: 快速CSS修复:

.ui-widget-overlay {
   position: fixed;  /* <---------- */
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
}

Or call this when you open your dialog: 或者在打开对话框时调用它:

open: function(event, ui){
    $('body').css('overflow-x', 'hidden');
}

Why has the dialog container div got the style property position set to relative , this should be absolute going by the jQuery UI demo . 为什么对话框容器div将样式属性position设置为relative ,这应该是jQuery UI演示的 absolute

When I change it to absolute in firebug the scrolbar problem resovles itself. 当我在firebug中将其更改为absolute时,滚动条问题会自行恢复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM