Skip to content

Instantly share code, notes, and snippets.

@benadamstyles
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benadamstyles/1155f662c4a1ad93f718 to your computer and use it in GitHub Desktop.
Save benadamstyles/1155f662c4a1ad93f718 to your computer and use it in GitHub Desktop.
Helper function to remove element from DOM after a CSS transition has completed
window.namespace.killer=function(el,classNameString) {
function die() {
el.removeEventListener("webkitTransitionEnd",die);
el.parentNode.removeChild(el);
}
el.addEventListener("webkitTransitionEnd",die);
el.classList.toggle(classNameString);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment