JavaScript调整大小 - div没有正确渲染 - 圣杯布局 - CSS

时间:2023-01-12 12:06:13

I've just completed my "awesome" dynamic holy grail layout in css and jquery https://jsfiddle.net/4hy2tkqv/

我刚刚在css和jquery中完成了我的“令人敬畏”的动态圣杯布局https://jsfiddle.net/4hy2tkqv/

However, although the page renders as expected when I press F5 - it doesn't render the inner circle div inside my circle container properly when the browser window changes.

但是,虽然当我按F5时页面按预期呈现 - 当浏览器窗口更改时,它不会正确地在我的圆形容器内呈现内圆div。

If I look at the variables in my firefox debugger,

如果我查看firefox调试器中的变量,

$('.circle').height($('.circle_container').width());
$('.circle').width($('.circle_container').width());

the circle container width is zero!! - making the inner circle disappear when resizing. What I fail to understand is why when I press F5 everything seems to work just fine.

圆形容器宽度为零!! - 调整大小时使内圈消失。我不明白为什么当我按F5时,一切似乎都运行得很好。

1 个解决方案

#1


0  

You got the Math wrong:

你的数学错了:

$('.circle_container').width($('.middle').width() - ($('.right').height() *2));

Should really be:

真的应该是:

$('.circle_container').width($('.middle').width() - ($('.right').width() *2));

I.E. in your else clause.

I.E.在你的else子句中。

#1


0  

You got the Math wrong:

你的数学错了:

$('.circle_container').width($('.middle').width() - ($('.right').height() *2));

Should really be:

真的应该是:

$('.circle_container').width($('.middle').width() - ($('.right').width() *2));

I.E. in your else clause.

I.E.在你的else子句中。