jquery animations - how to run at the same time?

How can I have these animations all run at the same time?  The $mask.fadeOut seems to run last regardless of the order of the commands (why is that?)

$MenuItems.stop(true,true).fadeOut(200); // sets display: none
$mask.fadeOut(200, function() { $mask.css('z-index', '0'); } );
$Toolbar.stop(true, true).animate({ backgroundColor: '#008000', height: ToolbarHeight }, 200 );

Open in new window

SAbboushiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle HamiltonData ScientistCommented:
look up "queue false". You can use it on the animate() method, not sure about fadeOut.


$Toolbar.stop(true, true).animate({ backgroundColor: '#008000', height: ToolbarHeight }, {queue:false, duration: 200} );
0
SAbboushiAuthor Commented:
Thanks - but no difference...
0
SAbboushiAuthor Commented:
I am new to jquery but I thought I read somewhere that fadeout calls animation routine.  Is there a way to make an animation call directly to do the fadout (.animate instead of .fadeOut) so that I can also specify queue:false for the fadeout animation - and then would they both happen at the same time?
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Kyle HamiltonData ScientistCommented:
yes. Instead of fadeOut use animate opacity, and a callback to hide()

$MenuItems.stop(true,true).animate({opacity:0}, {
                                                        queue:false, 
                                                        duration: 200, 
                                                        complete: function() {
                                                                    $(this).hide();
                                                                    }
                                                        });   
                

$mask.stop(true,true).animate({opacity:0}, {
                                                        queue:false, 
                                                        duration: 200,
                                                        complete: function(){
                                                                    $(this).hide().css('z-index', '0');
                                                                    }
                                                        });

$Toolbar.stop(true, true).animate({ backgroundColor: '#008000', height: ToolbarHeight }, {queue:false, duration: 200} );
		

Open in new window


with a duration of 200, it'll happens so quickly, you may not even notice the animation.

Also, you can't animate background color with animate, so you'll have to do that differently. You could try css3 animations, or a color plugin.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kyle HamiltonData ScientistCommented:
with css3:

$Toolbar.css({
                        '-webkit-transition': 'background-color 0.3s ease',
                        '-moz-transition': 'background-color 0.3s ease',
                        '-o-transition': 'background-color 0.3s ease',
                        '-ms-transition': 'background-color 0.3s ease',
                        'transition': 'background-color 0.3s ease'
                });                                        

                $Toolbar.css({ 'background-color': '#008000'}).stop(true, true).animate({'height': ToolbarHeight }, {queue:false, duration: 2000} );

Open in new window

0
Kyle HamiltonData ScientistCommented:
0
SAbboushiAuthor Commented:
Beautiful!!!  Thank you very much!

Pros and cons of jquery vs. css3?
0
Kyle HamiltonData ScientistCommented:
css3 will only work in modern browsers (that excludes IE < 9), but it's more lightweight. depends what you're targeting..

cheers.
0
SAbboushiAuthor Commented:
k thanks--
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.