开发者

refreshing height of html, body after appending content

开发者 https://www.devze.com 2023-02-22 00:05 出处:网络
i am appending content to the page on document load, after this I am using a light-box type overlay, the problem is that although the overlay is set to 100% height it only displays as high as the visi

i am appending content to the page on document load, after this I am using a light-box type overlay, the problem is that although the overlay is set to 100% height it only displays as high as the visible content, when you scroll down the overlay is not as high as the window.

I firebug shows that the html, body tags are not the full heig开发者_如何学JAVAht of the window, they are not adjusting their height when I append the ajax content.

Is there a way to refresh these heights after i Have loaded the content?


I've got a feeling I got around this once, but it was a bit of a hack.

Basically you load the ajax content into a new, hidden element (which is allowed to expand as tall as it needs to), then use jQuery to ask it's height. Then apply that value to your shown element.

I think at the time I was trying to load blog posts into a div which expanded height-wise.

Edit: This of course assumes you're willing to set absolute heights rather than use percentages.


Have you tried these; $(window).resize(); Or $(document).resize();

Try calling one of those after your function.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号