Posted By

cfleschhut on 03/08/10


Tagged

basic javascript image animation fading


Versions (?)

Basic JavaScript Image Fading


 / Published in: JavaScript
 

URL: http://jsfiddle.net/eXp5j/5/

  1. function fade(step) {
  2. var imgs = document.getElementsByTagName("img");
  3. step = step || 0;
  4. imgs[1].style.opacity = step/100;
  5. imgs[1].style.filter = "alpha(opacity=" + step + ")";
  6. step += 2;
  7. if (step <= 100) {
  8. setTimeout(function() {
  9. fade(step);
  10. }, 1);
  11. }
  12. }

Report this snippet  

You need to login to post a comment.