Pawel
Pawel

Reputation: 555

Callback function not working with css library

I have this simple part of code where callback function is not working:

$(document).ready(function() { 
    $(".target:nth-child(3)").addClass("animated shake",function(){
      $("body").addClass("animated hinge")
    });
  });

first function works just fine ( elements are shaking) but nothing happens after that.

I'm also using this css library: https://github.com/daneden/animate.css/blob/master/animate.css

Upvotes: 0

Views: 44

Answers (1)

Deepak
Deepak

Reputation: 870

You don't need a callback function in this case as the Jquery AddClass is not a asnychronous method i.e. the next statement will be executed only once addClass is executed.

This should simply work in your case:

$(".target:nth-child(3)").addClass("animated shake");
  $("body").addClass("animated hinge")

Upvotes: 1

Related Questions