Animating an element on window resize fires late
<p>I am checking the window height on resize and animating an element if it is within a certain height. However, the function fires late, usually 4 or 5 seconds after I have finished resizing the browser window. I need it to fire as soon as I've finished resizing. While I am resizing would be even better. Any help would be appreciated. Thanks.</p>

<p>Code is:</p>

<pre><code>$(window).resize(function() {
    adjustPanel();
});

adjustPanel = function() {
    if ($(window).height() &gt; 920) {
        $('#search-board-wrap').animate({
            height: 795,
            marginTop: 795
        });
    } else {
        $('#search-board-wrap').animate({
            height: 650,
            marginTop: 650
        });
    }
};
</code></pre>
