![]() |
waiting for a window.load value
Hi,
im attempting to read the height value of an element which doesnt have its height specified. If i get its value within document.ready then it intermittently returns the wrong value as im guessing the element has yet to be populated. I can get the correct value when using window.load but then need to pass this value to my code within document.ready. Is this possible? How else could i solve this. moving everything within a window.load doesnt work. Code:
|
simplified example
Code:
$(window).load(function() { |
Put your script at the bottom of the page and get rid of the unnecessary ready/load wrapper that is slowing down the loading of the page.
That might not fix the problem but at least you'll have your JavaScript where it belongs and will be able to tell if there are additional things it needs other than the entire HTML in the page before the script can run - and if it doesn't work properly there because of not everything it needs being loaded yet then you will know that it has to wait for the load event to be triggered. |
solved
i solved the problem by loading the first li tag with its content so i could get its height value and append it to the other li's tags. Next i hide the first li again and then continue with my normal load
Now the browser always gets the correct height value for the li tags :) |
| All times are GMT +1. The time now is 12:54 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.