-
Notifications
You must be signed in to change notification settings - Fork 0
/
gus.js
34 lines (30 loc) · 1.05 KB
/
gus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
let openBtn = document.querySelector('.button');
let modalWind = document.querySelector('.modal1');
let closeBtns = document.querySelectorAll('.close-button');
let formbtn = document.querySelector('.modal-button');
let contentContainer = document.querySelector('.modal-content');
let formCotent = contentContainer.innerHTML;
function backForm() {
contentContainer.innerHTML = formCotent;
}
function openModal() {
modalWind.classList.add('active-modal');
}
function closeModal() {
modalWind.classList.remove('active-modal');
}
openBtn.addEventListener('click', openModal);
closeBtns.forEach(el => {
el.addEventListener('click', closeModal);
});
function addNewContent() {
contentContainer.innerHTML = `
<div class="text-success">
<p class="text-success-thanks">Дякуємо, гусь успішно запущений</p>
<p class="text-success-adieus">Слава Україні! Героям Слава!</p>
</div>
`;
setTimeout(closeModal, 2000);
setTimeout(backForm, 2100);
}
formbtn.addEventListener('click', addNewContent);