dimanche 24 avril 2016

I need to use jquery inside a javascript if statement to animate the color of an element

if the user input contains a string and the user input is an element of words[]i add 10 to the score. else i subtract 1 from the lives but i would also like to animate the colors of the text from red and back to white

var text = document.getElementById("input").value;
    if (text.indexOf(rand) >= 0 && words.indexOf(text) >= 0) {
    score+=10;
} else {

    lives-=1;
    $("#wrdzyTitle").animate({color: "red" }slow);
    $("#wrdzyTitle").animate({color: "white" }slow);

}

the code does subtract 1 from the lives but does not animate the colors and i recieve no error messages

Aucun commentaire:

Enregistrer un commentaire