vendredi 2 septembre 2016

What's wrong with my code? Changing colour to a div slowly

Does anyone know why my code doesn't work? I want to change the color of a div slowly.

function fadein() {
    change = document.getElementsByClassName("load_1")[0]
    setInterval(function(){
        change.style.color = "rgb("+x+","+x+","+x+")";
        x=x+1
    }, 200)
};

function animate(){
    var x=0;
    fadein()
};

animate()

Aucun commentaire:

Enregistrer un commentaire