IE8 $('body').width() is 0 on $(window).load()
- by allicarn
On $(document).ready I run through a for loop twice and alert out the body's width ($('body').width();) each time through. I get a value I would expect (ex. 1092).
On $(window).load I run through another for loop twice, also alerting out the body's width each time through. I get 0 the first time through (and the page looks completely blank behind the alert), and then a value I would expect the second time through (ex. 1092).
This is an issue I am not able to replicate in a stripped-down example, nor any other browser (Chrome, Safari, Firefox, IE9, IE10).
Does anyone have any ideas, or other things that I could test for?
I am using $(window).load to cut up some divs based on their width, which is based on their font size, which is based on a webfont (which isn't necessarily loaded by the time $(document).ready fires).