Вспомнил еще вот тко вариант и тоже не сработало
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
header{
height: 500px;
}
footer{
height: 1500px;
}
.blok{
width: 80px;
height: 80px;
background-color:#000;
background-image: url(https://rakipov.ru/files/tsifra1.svg);
background-repeat: no-repeat;
background-position: center;
background-size: 70%;
border-radius: 7px;
}
.blok2{
width: 80px;
height: 80px;
background-color:#000;
background-image: url(https://rakipov.ru/files/icon1.svg);
background-repeat: no-repeat;
background-position: center;
background-size: 70%;
border-radius: 7px;
}
</style>
</head>
<body>
<header></header>
<section>
<div class="blok"></div>
</section>
<footer></footer>
<script>
const blok = document.querySelector(".blok");
let anim1 = () => {
if (pos >= 100) {
blok.style.backgroundImage = "url('https://rakipov.ru/files/icon1.svg')";
}
console.log(blok.offsetTop);
};
window.addEventListener("scroll", anim1);
</script>
</body>
</html>