简体   繁体   English

修改处理div的宽度

[英]modify width of processing div

I have this div that appears on loading pages: 我有此div出现在加载页面上:

<div id="divProcessing" style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; background-color: transparent;  z-Index: 2000;overflow:hidden; display:none;border:none;"/>

My problem is that on a page that has scroll bars the div is not expanded on all the page, only on screen size and i can access the content behind the div if i scroll. 我的问题是,在具有滚动条的页面上,div不会在所有页面上展开,只会在屏幕尺寸上展开,如果滚动,我可以访问div后面的内容。

I don't know how to expand or how to calculate the width/height of content page 我不知道如何扩展或如何计算内容页面的宽度/高度

If the div is a direct child of body , you can try adding: 如果divbody的直接子代,则可以尝试添加:

html, body {
    height: 100%;
    overflow: hidden;     /* in case your content is floated */
}

Do you have a page online where we can see it? 您是否有在线页面可以在其中看到?

I would use jquery, and you can get the height of the body element. 我将使用jquery,您可以获取body元素的高度。

$(body).css('height');

So you could then do the following: 因此,您可以执行以下操作:

$('#divProcessing').css('height', $(body).css('height') );

Which then sets your div's height to the same as the body of your page. 然后将div的高度设置为与页面正文相同的高度。

Edit: You mentioned width specifically but I was thinking height, the same will work for width, just replace 'height' with 'width' 编辑:您专门提到宽度,但是我在想高度,宽度也一样,只是将'height'替换为'width'

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

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