Solution 1 :

Here I wrote a solution using setTimeout instead of setInterval so you don’t need to take care about clearing it.

    var iteration = 0;
    var times = [5000, 15000, 30000]
    var showPopUp = function(time) {
        setTimeout(function() { 
        $('#timer').show();
        $('#timer').html("<span class='close'>X</span><h3>Count down complete</h3>"); }, time)
    }

    showPopUp(times[iteration]);

    $('body').on('click', '.close', function() {
        $('#timer').hide();
        iteration +=1;
        if (iteration < 3) {
          showPopUp(times[iteration])
        }
    });

Problem :

<div class="popup_div">Form here</div>

What I am doing is to make this “div” popup when the page loads after 5 seconds, then when the user closes the popup div it will count again to 15 seconds to appear again, then when the user closes it again it will show for another 30 seconds

This is the interval

5 secs (on page load)
15 secs
30 secs (final popup, it won't popup after this)

Here is My fiddle, hope this helps

https://jsfiddle.net/3xk725ts/

Comments

Comment posted by Mech

More info is needed.

Comment posted by Paul T.

Know that it is possible to make a fiddle here without an external link. See the icon with the

Comment posted by Louys Patrice Bessette

Welcome to SO. You have to show a specific issue on which you need help

Comment posted by Francis Alvin Tan

Thank you so much, this is what I need… 🙂

By