Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery slideToggle jumps around

Tags:

jquery

I'm using the jQuery slideToggle function on a site to reveal 'more information' about something. When I trigger the slide, the content is gradually revealed, but is located to the right by about 100 pixels until the end of the animation when it suddenly jumps to the correct position. Going the other way, the content jumps right by the same amount just before it starts its 'hide' animation, then is gradually hidden.

Occurs on IE7/8, FF, Chrome.

Any ideas on how I would fix this?

Thanks in advance.

like image 326
Darren Oster Avatar asked Oct 03 '08 10:10

Darren Oster


1 Answers

Adding CSS3 transition/transform properties always solved any jumping issues for me with slideToggle... Example:

-webkit-transform-origin: top;
-moz-transform-origin: top;
-ms-transform-origin: top;
-o-transform-origin: top;
transform-origin: top;

-webkit-transition: transform 0.26s ease;
-moz-transition: transform 0.26s ease;
-ms-transition: transform 0.26s ease;
-o-transition: transform 0.26s ease;
transition: transform 0.26s ease;
transition: -webkit-transform 0.26s ease;
like image 148
Steven Brand Avatar answered Sep 20 '22 05:09

Steven Brand