Jquery Safari和IE9最小高度优先于高度
我正在Windows中使用Safari 5.0.5和IE9测试一个网站。在CSS中,我有:Jquery Safari和IE9最小高度优先于高度,jquery,html,css,Jquery,Html,Css,我正在Windows中使用Safari 5.0.5和IE9测试一个网站。在CSS中,我有: #contentarea { background-image:url('../images/img.jpg'); background-repeat: no-repeat; background-position: right top; background-size:100% auto; min-height:650px; } 在jQuery中,我设置了如下高度:
#contentarea {
background-image:url('../images/img.jpg');
background-repeat: no-repeat;
background-position: right top;
background-size:100% auto;
min-height:650px;
}
在jQuery中,我设置了如下高度:
$(document).ready(function(){
var vertHeight = $('.innerpage #vBar').outerHeight(true);
$('.innerpage #contentarea').css({'height':vertHeight });
});
在div的style
属性中正确设置了height
。但是,即使height
小于min height
,这些浏览器似乎总是首先呈现min height
值。换句话说,高度
被完全忽略
我需要CSS中的minheight
,这样当它第一次呈现div时,它需要具有最小高度,因为jquery有时在第一页加载时似乎不起作用。根据定义,该属性始终覆盖height和max height,以防止height属性的值小于minheight
你应该检查你的元素高度,找出真正的最小值是多少。你应该在你的页面上使用这个值,这样它就不会干扰你的JQuery代码。如果
高度小于最小高度
,那么元素的最短高度应该是最小高度
的值。。。为什么不使用jQuery只更新min height
?