Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Firing up a function at the end of an event
- From: riegel at clearimageonline.com (Terry Riegel)
- Subject: [Javascript] Firing up a function at the end of an event
- Date: Fri May 25 11:29:35 2007
Hello All,
Is there a way to have a function call another function when it is
done? I have a fadeIn and a fadeOut function that takes place over
time. I would like to have it call a passed function when it
finishes. I have listed my function below.
function fadeIn (id,duration,steps,currstep) {
stepDuration = Math.round(duration/steps) ; // Value is in
miliseconds.
obj = dd.elements[id];
obj.setOpacity(1-(1/steps)*currstep);
currstep --;
if(currstep>=0){
setTimeout('fadeIn("'+id+'",'+duration+','+steps+','+currstep
+')',stepDuration);
}
else
{dd.elements[id].show();
}
return;
}
I would like to have it work something like this...
function fadeIn (id,duration,steps,currstep,MYFINISHINGFUNCTION) {
stepDuration = Math.round(duration/steps) ; // Value is in
miliseconds.
obj = dd.elements[id];
obj.setOpacity(1-(1/steps)*currstep);
currstep --;
if(currstep>=0){
setTimeout('fadeIn("'+id+'",'+duration+','+steps+','+currstep
+')',stepDuration);
}
else
{dd.elements[id].show();
MYFINISHINGFUNCTION;
}
return;
}
I would call it something like...
fadeIn("currentslide",500,10,10,swapimage(a,b) );
Is this possible? If so what would be the proper syntax for such a
convention
- Follow-Ups:
- [Javascript] Firing up a function at the end of an event
- From: Billy Reisinger
- [Javascript] Firing up a function at the end of an event
- Prev by Date: [Javascript] Why is firefox acting lazy?
- Next by Date: [Javascript] Firing up a function at the end of an event
- Previous by thread: [Javascript] Why is firefox acting lazy?
- Next by thread: [Javascript] Firing up a function at the end of an event
- Index(es):