const animation=document.querySelectorAll('.fade');
console.log(animation);
window.addEventListener("scroll",fadeIN);
function fadeIN()
{
for (let i=0; i<animation.length; i++)
{
let j=animation[i];
let height = j.getBoundingClientRect().top - window.innerHeight + 20;
if (height < 0) {
j.classList.add("visible");
} else {
j.classList.remove("visible");
}
}
}
fadeIN()
help me to change this logic
let height = j.getBoundingClientRect().top - window.innerHeight + 20;
with simple JavaScript code with using web API libraries
this javascipt code is about to fade-in fade-out animation code is working but i have to change this DOMreact code,let height = j.getBoundingClientRect().top - window.innerHeight + 20; with simple javascript logic is it possible
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.