Сообщение от рони
|
<script>
document.addEventListener("DOMContentLoaded", function() {
const termsOfUse = document.querySelector(".terms_of_use");
const iAgree = document.querySelector(".i_agree");
const main = document.querySelector(".main");
const key = "yes";
window.addEventListener("load", function() {
if (key in localStorage) return;
var height = termsOfUse.scrollHeight;
main.style.setProperty("--height", `${height}px`);
document.body.classList.add("down");
iAgree.addEventListener("click", function() {
document.body.classList.remove("down");
main.style.removeProperty("--height");
localStorage.setItem(key, "hide");
})
})
});
</script>
</body>
</html>
[/html]
|
Вот эта запись мне больше нравится, и я ее вроде понимаю
А почему луче делать классы заменять а не просто строку вставлять в уже существующие