this is the code
var x = Math.floor( Math.random() * 10 );
setInterval(function () {
if (x >= 5) {
$('.test').show();
setTimeout(function () {
$('.test').hide();
}, 2000);
} else {
x = Math.floor( Math.random() * 25 );
}
}, x * 1000);
this code show .test with the same random like if the x=8 it will stay 8 and doesn't change what I really want is changing x to another number
I've tried to put var x in the local scope and it show me x in setInterval is undifined
I wanna $('.test') shows in a random way between 5 and 10 second like first time show after 7S, second time after 9 second, etc... .
Aucun commentaire:
Enregistrer un commentaire