View Full Version : [SOLVED] Strange jQuery animation lag

July 27th, 2010, 02:38 PM

With the website I'm currently working on, I have this strange problem while animating some elements with jQuery.
Instead of trying to explain what's going wrong, I've made a sample of the problem. Have a look at this: http://www.zupa.be/AnimationLag/.
Hover one of the numbers at the upper right corner and click a link. The current green div should close smoothly and the matching div for the clicked link should open smoothly.
This is the function that contains the animations.

function setPanelWidth(){
$('.collapsed').animate({width:28},'fast','linear' ,function(){
$('.collapsed *').css('visibility','hidden');
var w = $('#main').width()-2;
w -= $(this).width()+2;
$('.panel *').css('visibility','visible');
All of you who know something about jQuery, just take a look at http://www.zupa.be/AnimationLag/, open the source, take a look at the script and make my day.

Thanks in advance!

July 28th, 2010, 10:27 AM
Well, at a glance, I don't see anything that could be causing too much trouble...

If you use
$('.collapsed *').hide(); and
$('.panel *').hide(); does it work faster?

Also, try to put

$('.collapsed *').css('visibility','hidden');
var w = $('#main').width()-2;
w -= $(this).width()+2;

Before the


to try and make it get to the resize animation faster.

July 28th, 2010, 12:27 PM
stackoverflow.com is a good forum for JQuery questions.

This forum is more Linux-centric.

While it's allowed to post a Linux-unrelated question here, that doesn't mean it's a good idea.
You'll probably get a better answer much faster, there.

July 29th, 2010, 03:00 PM
Thanks for the responses, I got it solved now.