Use JavaScript to chain animations with CSS

It’s been four and a half years since CSS transitions were first introduced in WebKit, and three have passed since they were joined by CSS keyframe animations. Both are now approaching the tipping point of browser implementation – they are supported in Chrome, Safari and Firefox, meaning that they’re already available to some 50 to 60 per cent of web users, and will soon be in Opera 12 and Internet Explorer 10. This means they’re ready for the spotlight.

Using CSS animations and transitions, henceforth known as CSS animation, has already been well covered (not least in .net), so in this tutorial I’m going to show you how CSS animations can be chained together using JavaScript event handlers, which really increases their potential. I’m going to do it by building a very simple, stacked-card carousel kind of thing – which flips between a set of chosen images.

  • Knowledge needed: Intermediate CSS, basic HTML, intermediate JavaScript
  • Requires: jQuery, Modernizr, modern web browser
  • Project time: 1-2 hours
  • Download source files

Thank you for reading 5 articles this month* Join now for unlimited access

Enjoy your first month for just £1 / $1 / €1

*Read 5 free articles per month without a subscription

Join now for unlimited access

Try first month for just £1 / $1 / €1

The Creative Bloq team is made up of a group of design fans, and has changed and evolved since Creative Bloq began back in 2012. The current website team consists of eight full-time members of staff: Editor Georgia Coggan, Deputy Editor Rosie Hilder, Ecommerce Editor Beren Neale, Senior News Editor Daniel Piper, Editor, Digital Art and 3D Ian Dean, Tech Reviews Editor Erlingur Einarsson and Ecommerce Writer Beth Nicholls and Staff Writer Natalie Fear, as well as a roster of freelancers from around the world. The 3D World and ImagineFX magazine teams also pitch in, ensuring that content from 3D World and ImagineFX is represented on Creative Bloq.