我有两个栏DIV布局设置一个格的基础上另一个div的高度
<div id="site-wrapper">
<div id="leftSidebar">
</div>
<div id="rightSide">
</div>
</div>
我的js
$('#leftSidebar').height($('#rightSide').height());
但是在IE7它是在增加的白色空间区域的高度底部。我的jquery是否正确?
我有两个栏DIV布局设置一个格的基础上另一个div的高度
<div id="site-wrapper">
<div id="leftSidebar">
</div>
<div id="rightSide">
</div>
</div>
我的js
$('#leftSidebar').height($('#rightSide').height());
但是在IE7它是在增加的白色空间区域的高度底部。我的jquery是否正确?
是,outerHeight应该为你做这个。
http://api.jquery.com/outerHeight说:
的顶部和底部填充和边界总是包括在.outerHeight()计算;如果includeMargin参数设置为true,则边距(顶部和底部)也包含在内。
所以,如果你有边距:
$('#leftSidebar').height($('#rightSide').outerHeight(true));
除非你对这些div有一些CSS规则(或许一般是div)或者甚至是p
或者其他任何标签,这应该没有问题。
你可以尝试outerHeight():
$('#leftSidebar').height($('#rightSide').outerHeight());
是,outerHeight应该为你做这个。
http://api.jquery.com/outerHeight说:
The top and bottom padding and border are always included in the .outerHeight() calculation; if the includeMargin argument is set to true, the margin (top and bottom) is also included.
所以,如果你有边距:
$( '#leftSidebar')的高度($( '#rightSide')outerHeight(真)。)。
在哪里放置它?
请使用正确的格式代码和其他东西。 –