From a848fbfc19929baeb80fc783e3263546af1dfe8c Mon Sep 17 00:00:00 2001 From: Ashley //// Date: Tue, 23 Jan 2024 18:44:45 +0000 Subject: [PATCH] make it click two times --- html/channel.ejs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/html/channel.ejs b/html/channel.ejs index ed24b759..8fb5bbb9 100644 --- a/html/channel.ejs +++ b/html/channel.ejs @@ -1481,17 +1481,28 @@ document.getElementById('search').addEventListener('keyup', function () { } }); }); + var isPopupOpen = false; - document.getElementById('popup-trigger').addEventListener('click', function (event) { - event.preventDefault(); - document.getElementById('popup-container').style.display = 'block'; - document.body.style.overflow = 'hidden'; - }); + function togglePopup() { + if (isPopupOpen) { + closePopup(); + } else { + document.getElementById('popup-container').style.display = 'block'; + document.body.style.overflow = 'hidden'; + } + isPopupOpen = !isPopupOpen; + } function closePopup() { document.getElementById('popup-container').style.display = 'none'; document.body.style.overflow = 'auto'; + isPopupOpen = false; } + + document.getElementById('popup-trigger').addEventListener('click', function (event) { + event.preventDefault(); + togglePopup(); + }); // @license-end