0
0
mirror of https://github.com/Maks1mS/free-ozon-dpr.git synced 2024-12-23 10:32:58 +03:00

fix: hide map while popup is opened

This commit is contained in:
Maxim Slipenko 2024-06-09 08:14:56 +03:00
parent be1acbbbf8
commit baa73c0c2e
2 changed files with 20 additions and 14 deletions

View File

@ -1,22 +1,26 @@
import Cookies from "js-cookie";
import { el } from "./utils.js";
const HIDE_INFO_POPUP = "hideInfoPopup";
document.addEventListener("DOMContentLoaded", function () {
const infoPopup = document.querySelector(".info-popup");
const noShowCheckbox = document.querySelector('input[name="no-show"]');
const confirmButton = document.querySelector('.info-popup footer button');
const infoPopup = document.querySelector(".info-popup");
const noShowCheckbox = document.querySelector('input[name="no-show"]');
const confirmButton = document.querySelector(".info-popup footer button");
const map = el("map");
const hidePopupCookie = Cookies.get(HIDE_INFO_POPUP);
if (!hidePopupCookie) {
infoPopup.style.display = "block";
}
const hidePopupCookie = Cookies.get(HIDE_INFO_POPUP);
if (!hidePopupCookie) {
infoPopup.style.display = "block";
map.style.display = "none";
}
confirmButton.addEventListener("click", function () {
if (noShowCheckbox.checked) {
Cookies.set(HIDE_INFO_POPUP, "true", { expires: 400 });
}
confirmButton.addEventListener("click", function () {
if (noShowCheckbox.checked) {
Cookies.set(HIDE_INFO_POPUP, "true", { expires: 400 });
}
infoPopup.style.display = "none";
});
infoPopup.style.display = "none";
map.style.display = "block";
});
});

View File

@ -75,4 +75,6 @@ body {
.ol-attribution a:hover {
color: var(--ol-brand-color);
text-decoration: underline;
}
}
.info-popup-content > p { text-align:justify; }