You could try to fetch the height
using jQuery.
alert($("div.hidden_div").css("height"));
Example: http://jsfiddle.net/YT75Z/
题
I have a div which is hidden and has absolute position and i want to get it's height so i can set it via jQuery
.parent2{
display: block;
position: relative;
overflow: hidden;
width: 100% !important;
height: 100% !important;
}
.hidden_div{
position: absolute;
width: 100% !important;
height: 100% !important;
padding: 15px;
top: 0;
left: 0;
opacity: 0;
visibility: hidden;
overflow: hidden;
overflow-y: auto;
}
I have tried the following without any result:
var div_height = $(".hidden_div").height();
var div_height = $(".hidden_div").outerHeight();
var div_height = $(".hidden_div").actual("height");
//or innerHeight or outerHeight using the plugin at https://github.com/dreamerslab/jquery.actual/
EDIT:
this is the layout:
<div class="parent1">
<div class="parent2">
<div class="hidden_div">
</div>
</div>
</div>
parent1 has no css
解决方案
You could try to fetch the height
using jQuery.
alert($("div.hidden_div").css("height"));
Example: http://jsfiddle.net/YT75Z/
其他提示
If possible, try removing position:relative;
from .parent2
.parent2{
display: block;
overflow: hidden;
width: 100% !important;
height: 100% !important;
}