Using this
$('.trigger').click(function() {
$(this).next().toggle();
});
to toggle the very next div element works nicely. Now I would like to add some animations with animate.css. Clicking the tricker link opens the div with the animation I choose, but another click on the link does not close the div. It opens/closes on click with the upper code. What am I doing wrong here?
<div class="trigger">
<div class="hello">Welcome</div>
</div>
<div class="drop-down-main" style="display:none";>
<div class="text">
<div class"small">Lorem Ipsum</div>
</div>
</div>
JS
$('.trigger').click(function() {
$(this).next().toggle().addClass("animated pulse");
});
Thanks for your help!
toggle()instantly makes the element visible before the animations on the CSS classes have a chance to be applied.animated pulse