How to make a click automatickeho active after closing the modal window?

There is a modal window that closes automatically after a certain time
I found a couple of ways to do it, but after it closes, click on more triggers and modelka't open.


2 example of closing applied.
in the 1st case there is a closure using display:none takes place.
2nd not really clear to me how it works, just darkens the page and generally inactive.

How can I do to click on the button active again? A bunch of googling but can't find the info.
March 23rd 20 at 18:43
1 answer
March 23rd 20 at 18:45
Solution
You have not activated the class .modal_active because hanged the display of the NAS through an attribute, and it has priority than the class.
just fix the add display none
var button = document.querySelector('#button');
var modal = document.querySelector('#modal');
var close = document.querySelector('#close');


button.addEventListener('click', function() {
modal.classList.add('modal_active');
});

close.addEventListener('click', function() {
modal.classList.remove('modal_active');

});
// 1st method 
setTimeout(function(){
modal.classList.remove('modal_active');
}, 5000);
Thank you. it worked, but after the 1st automatic closing stops.
just changed setTimeout to setInterval. = seems to work.

I thought it should be such as to override the display none advanced.
Or do closure to automatically Trigonella cross. - louisa_Weber20 commented on March 23rd 20 at 18:48

Find more questions by tags JavaScript