GeorgieDev,
какие ваши доказательства?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>alert</title>
<style type="text/css">
* {
margin: 0;
}
body{
margin: 0;
padding: 0;
font-family: sans-serif;
display: block;
}
.center-box{
position: relative;
top: 43vmax;
left: 50vmax;
transform: translate(-50%, 50%);
height: 2.2vmax;
width: 26vmax;
margin: 0.5vmax;
color: rgb(0, 0, 0);
font-size: 0.75;
font-weight: bold;
background-color: rgba(243, 16, 16, 0.6);
box-shadow: 6px 5px 20px rgba(150, 8, 8, 0.836), 0 3px 10px rgba(150, 8, 8, 0.836);
}
.alert-circle{
position: relative;
height: 1.8vmax;
margin-left: 1.5vmax;
margin-top: 0.25vmax;
}
.alert-p{
position: fixed;
line-height: 2.2vmax;
top: 0vmax;
left: 4vmax;
width: 20vmax;
font-size: 0.85vmax;
word-wrap: break-word;
text-align: center;
}
</style>
</head>
<body>
<div class="center-box">
<img src = "./imgs/icon_error.png" class="alert-circle"></img>
<p class = "alert-p">123321123</p>
</div>-->
<script>let i = 0; let result;
function createNewAlert(text, state){
let center_block = document.createElement('div');
let alert_circle = document.createElement('img');
let p = document.createElement('p');
// создание структуры элементов
center_block.prepend(p); center_block.prepend(alert_circle);
// добавл классов элементам
center_block.className = "center-box";
center_block.style.zIndex = 1000;
center_block.style.zIndex--;
alert_circle.src = "./imgs/alert-circle.svg";
alert_circle.className = "alert-circle";
p.className = "alert-p";
p.style.color = "white";
p.innerHTML = text;
if(state == "success"){
alert_circle.style.color = "rgba(52, 209, 5, 1)";
p.style.color = "rgba(52, 209, 5, 1)";
center_block.style.backgroundColor = "rgba(0, 0, 0, 0.6)";
center_block.style.boxShadow = "6px 5px 20px rgba(52, 209, 5, 0.843), 0 3px 10px rgba(52, 209, 5, 0.843)";
}
else if (state == "error"){
center_block.style.border = "2px solid rgba(150, 8, 8, 0.836)"
center_block.style.backgroundColor = "rgba(0, 0, 0, 0.6)";
center_block.style.boxShadow = "6px 5px 20px rgba(150, 8, 8, 0.836), 0 3px 10px rgba(150, 8, 8, 0.836)";
}
//if(i == 0){center_block.style.bottom = 2 + "vmax";}
i++;
let box = document.querySelector('.center-box');
if(box) box.before(center_block);
else document.body.append(center_block);
let timer = setTimeout(() => {
// center_block.remove();
clearTimeout(timer);
center_block.style.zIndex++;
i--;
}, 5000);
}
createNewAlert("1111", "error");
createNewAlert("2222", "error");
createNewAlert("3333", "error");
</script>
</body>
</html>