Skip to content

Instantly share code, notes, and snippets.

@englishextra
Last active May 9, 2016 15:44
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 englishextra/818ba5b558f9c15f9776684b8e8feaf9 to your computer and use it in GitHub Desktop.
Save englishextra/818ba5b558f9c15f9776684b8e8feaf9 to your computer and use it in GitHub Desktop.
FadeOut in pure JS
/*!
* Fade Out
* gist.github.com/englishextra/818ba5b558f9c15f9776684b8e8feaf9
* youmightnotneedjquery.com
* chrisbuttery.com/articles/fade-in-fade-out-with-javascript/
* fadeOut(el);
*/
function fadeOut(el){el.style.opacity=1;(function fade(){if((el.style.opacity-=.1)<0){el.style.display="none";}else{requestAnimationFrame(fade);}})();}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment