 <p>My understanding is that you want to execute the onResize() function when the resize event is received. You seem to be a bit out of sync with how the document-ready stuff is intended to work -- and I recommend that you read some of the basic jquery tutorials -- but, basically, you want to use the function in $(function()....) to apply the event handler to the window after the document is fully loaded. </p> <p>Here, you seem to be -- mistakenly -- assuming that your running $(window).resize... after calling $(docyument).ready...would have waited until the .ready() function executed, but that's not how that works. The code that should be executed after the document reaches the fully-loaded state should go into the function parameter to $().</p> <p>Basically, you want to put your event handler assignment in the .ready() function like this:</p> <pre><code>$(function() { $(window).resize(onResize); }); </code></pre>