0

I am using waypoints.js and animate.css as this example: http://miguelmanchego.com/samples/2014/jquery-mostrar-animaciones.htm to add animations when scrolling.

If I have the structure:

<div class="FlyWithMe">
   <div>I am a bird!</div>
   <div>Mee too!</div>
</div>

I can of course animate them with:

    $('.FlyWithMe').waypoint(function() {
        $(this).toggleClass( 'bounceIn animated' );
    }

But how can I define the child element to animate them instead of a container?

    $('.FlyWithMe').waypoint(function() {
        $(this>child).toggleClass( 'bounceIn animated' );
    }

Of course I could add the class to the child element directly but this is just an example of a more complex case.

1
  • Oh, let me take a look at it.
    – Rafael
    Commented May 26, 2016 at 17:06

1 Answer 1

5

Use find function to select children:

$(this).find('div').toggleClass( 'bounceIn animated' );

Not the answer you're looking for? Browse other questions tagged or ask your own question.