4

i would animate two elements after a delay called on the parent element. the HTML could be like this:

<div id='daddy'>
 <span id='text'>some text</span><a id='link'>a link</a>
</div>

i need something like this to call "function"

$("#daddy").fadeIn(300).delay(10000).function()
{
 $("#text").animate({[some stuff]});
 $("#link").animate(
  {
    [some stuff],
    [some other]
  });
}

i tried to have a look on .trigger("myPersonalEvent") and creating a customized event, but i think is not the right way to perform what i need... good idea could be allowing a callback after delay(), but it's not possible

i also appended a fake animation calling a fallback after that, but neither this solution excites me so much..

something better?

  • An answer to a similar question is what I found useful: http://stackoverflow.com/questions/7915140/callback-to-delay – Pow-Ian Jan 03 '13 at 19:31

1 Answers1

3

I would use setTimeout inside of the callback function for fadeIn.:

$("#daddy").fadeIn(300, function () {   
    setTimeout(function()
    {
        $("#text").animate({[some stuff]});
        $("#link").animate(
        {
            [some stuff],
            [some other]
        });
    }, 10000);
});
Andrew Whitaker
  • 124,656
  • 32
  • 289
  • 307