Skip to content

Instantly share code, notes, and snippets.

@petermac-
Last active September 12, 2015 19:14
Show Gist options
  • Save petermac-/429bc799f3695896018f to your computer and use it in GitHub Desktop.
Save petermac-/429bc799f3695896018f to your computer and use it in GitHub Desktop.
detect-animation-end-examples.js
// jQuery example
// http://osvaldas.info/examples/detecting-css-animation-transition-end-with-javascript/oncssanimationend.js
$( '.item' ).addClass( 'disappear' ).onCSSAnimationEnd( function()
{
$( this ).remove();
});
// JavaScript example
// http://osvaldas.info/examples/detecting-css-animation-transition-end-with-javascript/jquery.oncssanimationend.js
var item = document.querySelector( '.item' );
item.classList.add( 'disappear' );
item.onCSSAnimationEnd( function()
{
item.parentNode.removeChild( item );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment