Ну вот вроде получилось
const termsOfUse = document.querySelector(".terms_of_use");
const iAgree = document.querySelector(".i_agree");
const main = document.querySelector(".main");
const test = 50;
setTimeout(function (){
termsOfUse.style.transform = "translateY(0%)";
termsOfUse.style.position = "fixed";
termsOfUse.style.top = "0" + "px";
}, 10);
function appearance(){
let blockHeinght = termsOfUse.getBoundingClientRect().height;
main.style.transform = "translateY(" + blockHeinght + "px)";
console.log(termsOfUse.getBoundingClientRect().height);
}
appearance();
function back(){
termsOfUse.style.transform = "translateY(-100%)";
termsOfUse.style.position = "";
termsOfUse.style.top = "0" + "px";
let blockHeinght = termsOfUse.getBoundingClientRect().height;
main.style.transform = "translateY(" + "0" + "px)";
console.log(termsOfUse.getBoundingClientRect().height);
}
iAgree.onclick = back;
Скажите это нормальный код или инвалид на костылях