Completing jQuery animations on page unload
<p>Is there a way to perform a jQuery animation before a user navigates away from a page by clicking on a link, or clicking the back/forward buttons. </p>

<p>It seems like doing the animation in response to an unload event would be sure to cover all the conditions under which a user may leave a page. </p>

<p>However, the new page is loaded before the animation can complete. I could do a busy wait, but that isn't very elegant.  </p>

<p>Alternatively, I could intercept clicks on anchors. But that doesn't account for back/forward clicks and possibly other conditions under which user would navigate away from a page.</p>

<p>Yes, I understand that this type of behavior is frowned upon because it leaves the user waiting.  However, I am attempting to do this in a very particular situation in which I believe the pros outweigh the cons. </p>
