html - Javascript div fade in not working using setInterval -


i'm trying make div containing number of pictures fade in not working , don't know why. believe inverval not being called. div's opacity set 0.0 code:

var movies = getelementbyid("movies");      var apparence = function(){         if(movies.style.opacity < 1.0){             movies.style.opacity = movies.style.opacity + 0.1;         } else { clearinterval(timer);         }      }      var timer = window.setinterval(apparence, 1000); 

thank much.

to set movies var, need call:

document.getelementbyid('movies'); 

the way attempting increment opacity didn't work, i've updated example.

new code:

var movies = document.getelementbyid("movies"); var opacity = 0.1; var apparence = function(){     if(opacity <= 1.0) {         movies.style.opacity =  opacity;     } else {          clearinterval(timer);     }     opacity += 0.1; }  var timer = window.setinterval(apparence, 1000); 

js fiddle:

http://jsfiddle.net/onov6cq4/1/


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -