Run functions after jquery delay

i could animate two elements after the delay caused by the parent element. HTML might look 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 the "

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

I tried to take a look at .trigger ("myPersonalEvent") and create a custom event, but I think this is the wrong way to accomplish what I need ... a good idea might be the ability to call back after a delay (), but this is not possible

I also added a fake animation that caused a rollback after that, but none of these solutions excite me so much.

is something better?

+4
source share
1 answer

I used setTimeout inside the callback function for fadeIn .:

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

Source: https://habr.com/ru/post/1387290/


All Articles