Перейти к содержимому
Главная
Направление
Новости
Работы ▾
HTML
JS
PHP
Мои статьи
Модальное окно
Назад
const deleteBtn = document.getElementById("delete-btn"); const deleteBtn2 = document.getElementById("delete-btn2"); const deleteBtn3 = document.getElementById("delete-btn3"); const popup = document.getElementById("popup"); const noBtn = document.getElementById("no-btn"); deleteBtn.addEventListener("click", () => { popup.style.display = "block"; overlay.classList.add("show"); }); deleteBtn2.addEventListener("click", () => { popup.style.display = "block"; overlay.classList.add("show"); }); deleteBtn3.addEventListener("click", () => { popup.style.display = "block"; overlay.classList.add("show"); }); noBtn.addEventListener("click", () => { popup.style.display = "none"; overlay.classList.remove("show"); });
button { padding: 0px 0px; border-radius: 0px; border: none; background-color: #1c87c9; color: #fff; font-size: 16px; } .popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 20px; border-radius: 5px; background-color: #fff; box-shadow: 0 0 20px rgba(0, 0, 0, 0.2); z-index: 9999; display: none; } .popup__content { display: flex; flex-direction: column; align-items: center; } .popup__title { margin: 0 0 20px; font-size: 18px; font-weight: 600; text-align: center; } .popup__button { padding: 15px 60px; border-radius: 5px; border: none; background-color: #1c87c9; color: #fff; font-size: 16px; cursor: pointer; }
Results:
Модальное окно
Назад