Javascript Calculation Sometimes Not Happening
In the following code snippet: var scr_h = $(document).height(); var scr_w = $(document).width(); var logo = { widt
Solution 1:
I guess it depends on when the code executes with respect to the page being rendered, which is indeterminate if the code is wrapped in $(function(){...}) or similar.
You could try measuring the window rather than the document:
var scr_h = $(window).height();
var scr_w = $(window).width();
Post a Comment for "Javascript Calculation Sometimes Not Happening"