Pawel Pawel -4 years ago 72
jQuery Question

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:

Answer Source

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")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download