Choosing a child class tag in jquery

I was looking for a jquery site for this ... and I just can't find it.

I am trying to select <p> tags in a class .desc ...

 <div class = "desc"> <p>blahwhatever</p> </div> 

I am trying to make sure that <p></p> not displayed until my .desc animation is done ...

 $(".desc p").hide(); //animation here... $(".desc p").delay(500).show(); 

It hasn't worked yet ... any suggestions? (Sorry for the trivial question ..)

+4
source share
2 answers

To make it work the way you would like to add the show to the callback of the animate() methods, try this:

 $(".desc p").hide(); $('#animationSelector').animate( { /* animation settings */}, 5000, function() { $(".desc p").show(); } ); 

working example: http://jsfiddle.net/X3qkH/

+5
source

A simple solution here is to pass the value ( 0 absolutely accurate) to .show() .

 $(".desc p").delay(500).show(0); 

This ensures that it is added to the fx queue and, therefore, takes effect .delay() .

Demo : http://jsfiddle.net/MuZMa/1/

Without a value .show() will immediately run display: block .

+4
source

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