some advice on how to write a window.resize function?
<p>Im trying to write a function that resizes the css widths of some elements when the browser window is resized, right now I dont seem to be getting things right and would love it if someone could help me out on where Im going wrong, my code so far is:</p>

<pre><code>function windowResize() {
            $('#content').css('width', $windowWidth);
            $('#div.mySection').css('width', $windowWidth);
            $('#div.mySection .story').css('width', $windowWidth);
        }

$(document).ready(function() {

            var $windowWidth = $(window).width();               

            $(window).resize(function() {
                windowResize();
            });

        });
</code></pre>

<p>Im not sure if I have placed everything in its correct place, if someone could advise me on how I can make this code much better it would be great.</p>

<p>Thanks
Kyle</p>
