views:

181

answers:

3

Hi guys!

My jQuery slideToggle() experiment

Can anybody tell me why my boxes "jump" when i open them? The first half they slide, the rest they "jump"??

Thanks, Johannes

A: 

I found this problem in many occasions in which I was animating just the height with slideToggle but not the margin/padding.

So, something like this might solve it:

$("#thediv").slideToggle().animate({"margin-bottom": "toggle"});
Seb
A: 

The quickest fix in your case:

.message_container { width: 361px; }

I'm not sure exactly why, but not giving the container a fixed width when containing a <p> causes issues, give it one and the jumpyness goes away.

Nick Craver
+3  A: 

Its a simple fix. Add this CSS rule to your stylesheet (Tested in Firebug to work, and from my past experience with this problem, this is the fix):

ol.message_list { position: relative }

It is a CSS bug, not a jQuery bug per se.

Doug Neiner
+1 Tested. Seems to have cleaned it right up.
Jonathan Sampson
I had the same problem, and tried this fix, but it didn't work for me so I had to give up and take a different approach (right before the slide, make the sliding-in portion visible with opacity 0, move the container up that much, then just slide it back down that way).
ehdv