javascript - Use js to write a pop-up based on a fixed time, pop-up three times
迷茫
迷茫 2017-06-12 09:32:02
0
4
735

Write an interpretation using js, for example: for a layer, the first time it pops up after 10 seconds, after it is closed, it pops up again after 20 seconds, and after it is closed, it pops up again after 40 seconds. Then it doesn't pop up.

var firstShow = 10000;
var secondShow = 20000;
var threeShow = 400000;

setTimeout(openMpM, firstShow);
function openMpM() {
    $("#swtCenter2").fadeIn(1000);
}

var clearAfter = setTimeout(openMpM, secondShow);
var clearAfter1 = setTimeout(openMpM, threeShow);

function closeM() {
    $("#swtCenter2").fadeOut(1000);
    setTimeout(openMpM, 50000);
}

I just don’t have any ideas. How can I make him stop playing after three times? I hope to write it in detail.

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!