Ah! Also good to know! I see what you mean about the anonymous
functions. I reorganized the script with sequential functions, and it
works exactly how I want, thanks!
--
function sequence1() {
$('#box1').animate({opacity: 0.1}, 5000, sequence2);
}
function sequence2() {
$('#
Every animation can have an 'on completion' callback ...
eg.
$('#box1')
.animate(
{ opacity: 0.1} // what
, 5000 // speed
, function(){ // callback
$('#box2').animate( {left: '200px' }, 2000);
} // end of callback
); // end of animate
Just be careful not
Ah!
Michael: thanks! Now I know how that works.
Wizzud: thanks! It works perfectly! Here's the code for anyone else
interested:
$('#box1').animate({opacity: 0.1}, 5000);
setTimeout(function() { $('#box2').animate({left: '200px'}, 2000); },
5000 );
I was also wondering if there is a way for
Sorry about that, I was writing from memory and got the 'what' and the
'when' the wrong way round!
Correct format for setTimeout is ...
var timeout = setTimeout ( script-to-execute, time-in-milliseconds );
... so just swap the 2000 and the function around.
Apologies.
On Oct 11, 1:55 am, "Micha
You have the arguments to setTimeout reversed.
setTimeout is a browser function, not a jQuery function. Just Google for
javascript settimeout and you'll find it.
-Mike
> From: marc0047
>
> Thanks, 'setTimeout' gives me a big jump start!
>
> However, I had a little trouble getting it to work:
Thanks, 'setTimeout' gives me a big jump start!
However, I had a little trouble getting it to work: Firebug is warning
me that setTimeout is possibly missing quotes and arguments, but I'm
pretty sure I followed your example exactly. The following setup has
the yellow box (#box1) performing the o
load ...
success callback starts function(){
$('#yellowDiv').fadeOut('normal', function(){
var offset = $('#blueDiv').offset(); // using dimensions
plugin, or
var offset = {left:$('#blueDiv').css('left')}; // if css has
left set, or whatever
setTimeout(2000, functi
7 matches
Mail list logo