2

I'm adding a number of different classes to different objects on my page to animate them.

I add them using addClass with jquery upon page load.

I was wondering if there was a way to chain this, so I could add the first .animate class to my first element and when that's done, add the next .animate class to another element.

1 Answer 1

1

Best you can do is detect the end of a css3 transition, and have some logic to change the classes so the next transitions apply.

$("#foo").on('webkitTransitionEnd transitionend msTransitionEnd oTransitionEnd', function(){
      if($(this).hasClass('transition1'){
           $(this).removeClass('transition1').addClass('transition2');
      }
      // apply whatever logic you want to handle the transition chaining.
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.