Kendell Daniel
Kendell Daniel

Reputation: 47

Jquery .load function and adding and removing classes

I'm trying to add custom css animations to some images, but I just can't seem to get my head wrapped around the solution. My code is found below. On window load I would like the class 'animated shake' to be added to the element with the id "blue". After the animation occurs, remove the animation class.

$(window).load(function(){
      $("#blue").addClass('animated shake').0ne('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',function(){
          $(this).removeClass('animated shake');
    });
};

Upvotes: 0

Views: 574

Answers (2)

Brian
Brian

Reputation: 903

Do you not use the console to debug? You have a typo and missing parenthases that would have shown if you did.

$(window).load(function(){ 
    $("#blue").addClass('animated shake')
    .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',function(){
        $(this).removeClass('animated shake'); 
    }); 
});

Upvotes: 0

jfriend00
jfriend00

Reputation: 707486

You appear to have a typo:

.0ne() should be .one()

Upvotes: 0

Related Questions