Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
983 B
0
Indexable
Never
window.addEventListener('scroll', mostrarScroll);

// efecto encabezado
const left = document.querySelector(".left");
const right = document.querySelector(".right");
const container = document.querySelector(".container");

left.addEventListener("mouseenter", () => {
  container.classList.add("hover-left");
});

left.addEventListener("mouseleave", () => {
  container.classList.remove("hover-left");
});

right.addEventListener("mouseenter", () => {
  container.classList.add("hover-right");
});

right.addEventListener("mouseleave", () => {
  container.classList.remove("hover-right");
});

// efecto scroll
let animado = document.querySelectorAll(".animado");

function mostrarScroll () {
    let scrollTop = document.documentElement.scrollTop
    for (var i =0; i < animado.length; i++ ){
        let alturaAnimado = animado[i].offsetTop;
        if(alturaAnimado - 10 < scrollTop) {
            animado[i].style.opacity = 1;
        }
    }
}