Okay, I have a unique situation, first I am creating 10 <li>s using jQuery append(). Then I am adjusting the height of each <li> to be the window height / 10 so that as a whole they fill the whole screen height. My html contains nothing but <div class="wrapper"></div>. Here is my js:
// Create The Tree:
$('.wrapper').append('<ul>');
for (var x = 1; x <= 10; x++)
{
$('.wrapper > ul').append('<li>Root Option ' + x + '</li>');
}
// Script The Tree:
var $winHeight = document.documentElement.clientHeight;
console.log($winHeight);
var $liNumber = $('.wrapper > ul > li').size();
var $liHeight = $winHeight / $liNumber;
$('.wrapper > ul > li').css('height', $liHeight);
var $win = $(window)
$win.on('resize', update);
function update () {
console.log(document.documentElement.clientHeight);
}
My problem is that if you view the console, you can see that it does not accuratly update the height of the window. When you resize the window, it wont log values lower than what it was when you last refreshed the page!
Do you mean this? http://jsfiddle.net/reKSm/2/
Also, you have to have doctype defined.
Place
<!doctype html>at the beginning of your html file and it will work.And also don’t place the upper JS code into another $(document).ready() function. At already has one in it 🙂