mardi 29 août 2017

Why my if/else statement is not working!!! JavaScript [on hold]

I do not have any idea about why my if statement is not working... I have tried both == and ===, but it still not working, I will be very happy if you will help, thanks for you attention PLEASE HELP!!!

var images = [$('.image1'), $('.image2'), $('.image3')];
var x = true;
if(x == true ){
setTimeout(() => {
    images[1].fadeIn();
    images[1].animate({
        'backgroundSize': '100%',
        'opacity': 1
    }, 2000, () => {
    });
    images[0].animate({
        'backgroundSize': '350%',
        'opacity': 0.2
    }, 3000, () => {
        images[0].attr('id', 'none');
    });
}, 4000);
x = false;
}
else{
setTimeout(() => {
    images[2].fadeIn();
    images[2].animate({
        'backgroundSize': '100%',
        'opacity': 1
    }, 2000, () => {
    });
    images[1].animate({
        'backgroundSize': '350%',
        'opacity': 0.2
    }, 3000, () => {
        images[1].attr('id', 'none');
    });
}, 4000);
x = true;
console.log(true)
}

Aucun commentaire:

Enregistrer un commentaire