Animate specific paragraph using wow.js onclick

Dawid picture Dawid · Apr 26, 2015 · Viewed 10.9k times · Source

I am using wow.js to animate different elements on the page when scrolling. Now I want to rise the animation only on the specific paragraph when clicked on the button (in jQuery).

<p id="reasons" class="wow fadeInUp" data-wow-delay="0.2s">x y z</p>

I don't want to initialize the page with the animation once again (see below), but only animate this concrete paragraph (with id = "reasons").

new WOW().init();

How can I do this?

Answer

Rafa Memmel picture Rafa Memmel · Aug 18, 2015

HTML:

<button type="button" class="btn btn-default" id="mybutton">button</button>

<p id="reasons" data-wow-delay="0.2s">x y z</p>

JQuery:

$("#mybutton").click(function(){
    $("#reasons").addClass("wow fadeInUp animated");
    $("#reasons").attr("style","visibility: visible; animation-name: fadeInUp;");
});

On bootstrap tabs it also works. :-)