0

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');
    });
};
eebbesen
  • 5,070
  • 8
  • 48
  • 70

2 Answers2

0

You appear to have a typo:

.0ne() should be .one()

jfriend00
  • 683,504
  • 96
  • 985
  • 979
  • I just changed it to .one() but it does the same thing,any reason why? – Kendell Daniel Oct 19 '14 at 02:54
  • @KendellDaniel - Do you realize that individual class names can't have a space in them so if you're expecting `"animated shake"` to be a single class name with CSS attached to it, that wouldn't work? You'd have to show us the HTML and CSS for us to offer much further help as the issue could be any of those. Putting the code, HTML and CSS into a jsFiddle would be even better. – jfriend00 Oct 19 '14 at 02:56
  • @KendellDaniel - in the future, you really should look in the javascript error console BEFORE you come here because it would have shown you the missing paren. – jfriend00 Oct 19 '14 at 02:59
0

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'); 
    }); 
});
Brian
  • 903
  • 1
  • 7
  • 13