Сообщение от dima85
|
Не совсем понял о чем вы
|
document.documentElement.clientHeight;
<!doctype html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.alert {
position: fixed;
left: 0;
right: 0;
bottom: -30%;
transition-property: bottom;
transition-duration: 0.5s;
}
.alert-open {
bottom: 0%;
font-size: 48px;
text-align: center;
}
</style>
</head>
<body>
<script>
function test(text){
let elem = document.createElement('div');
elem.className = 'alert';
elem.innerHTML = text;
document.body.appendChild(elem);
document.body.scrollHeight;
elem.classList.add("alert-open");
}
test('text')
</script>
</body>
</html>