views:

128

answers:

1

Hi there,

I have a jquery animation .. actually its 2 .. fadein and then move with animation..

Problem is that it fades In completely FIRST and then ANIMATES (moves position) ...

What i am trying to do is start fadein and don't wait for it to finish (which appears to be happening at the moment) .. and start the animate..

hence both happening at the same time.. currently .. the first appears to run and wait... and then animate (changes location) runs..

Any ideas how to run both at the same time...

$('#Test').fadeIn("6000");
$('#Test').animate({ 'top': "-=100px" },"6000");
+2  A: 

How about this?

$('#Test').animate({'top' : '-=100px', 'opacity' : '100'}, '6000');

In this case you have to ensure that the element is visible, since fadeIn() also sets a "display" property.

Ivarska
Yes this is true, my element is hidden, so i set the opacity to 0 and then set it to show... but it doesn't same to fadein anymore... here is what i got.. $('#Test').css('opacity', '0'); $('#Test').show(); $('#Test').animate({ 'top': '-=100px', 'opacity': '100' }, '6000');
mark smith
I was wrong about the opacity; it's decimal and not percent. Run this on your hidden element: $('#Test').css({'opacity' : 0, 'display' : 'block'}).animate({'top' : '-=100px', 'opacity' : 1}, 6000);
Ivarska