SlideDown Animation Jump Revisited
Posted on 15th April 2009 — When using slideDown depending on the layout of your page, you could still see the jumping effect, regardless of whether you fix the padding around the element.








Posted on 15th April 2009 — When using slideDown depending on the layout of your page, you could still see the jumping effect, regardless of whether you fix the padding around the element.
Watch
Watch Animation Jump Revisited screencast (Alternative flash version)
QuickTime version is approximately 20Mb, flash version is streaming.
View the demo used in the screencast
Understanding the Problem
Similarly to before the animation would jump when it gets towards the end. However, this time the problem can’t be fixed by moving the padding around.
The problem is actually due to an incorrect height being determined, which is triggered by a number of factors. The element being animated…
position: absoluteand as such the margins around the top and bottom no longer collapse. This is to determine the height by bringing it back in to view (whiles havingvisibility: noneset) but not affecting the flow of the page.As you’ll see in the screencast, just setting a width doesn’t quite get the correct height.
So we can’t just use CSS to fix the jump, we need to write slightly different jQuery.
Fixing the Problem
The task requires us to:
Wrapping Up
I’m going to post a bug on the jQuery dev site, and I’ve had a play around the code to be able to accurately establish the height of a hidden element – it’s not easy.
Hopefully this might be one of the last times we run in to the jump problem!
You should follow me on Twitter here I tweet about jQuery amongst the usual tweet-splurges!