-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimate.js
38 lines (35 loc) · 1.32 KB
/
animate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
let aparecer = document.querySelectorAll('.aparecer');
function mostrarAparecerScroll(){
let scrollTop = document.documentElement.scrollTop;
for(var i=0; i<aparecer.length; i++){
let alturaAparecer = aparecer[i].offsetTop;
if(alturaAparecer - 500 < scrollTop){
aparecer[i].style.opacity = 1;
}
}
}
window.addEventListener('scroll',mostrarAparecerScroll);
let animadoDer = document.querySelectorAll('.animarDer');
function mostrarAnimadoDerScroll(){
let scrollTop = document.documentElement.scrollTop;
for(var i=0; i<animadoDer.length; i++){
let alturaAnimadoDer = animadoDer[i].offsetTop;
if(alturaAnimadoDer - 500 < scrollTop){
animadoDer[i].style.opacity = 1;
animadoDer[i].classList.add('mostrarDer')
}
}
}
window.addEventListener('scroll',mostrarAnimadoDerScroll);
let animadoIzq = document.querySelectorAll('.animarIzq');
function mostrarAnimadoIzqScroll(){
let scrollTop = document.documentElement.scrollTop;
for(var i=0; i<animadoIzq.length; i++){
let alturaAnimadoIzq = animadoIzq[i].offsetTop;
if(alturaAnimadoIzq - 500 < scrollTop){
animadoIzq[i].style.opacity = 1;
animadoIzq[i].classList.add('mostrarIzq')
}
}
}
window.addEventListener('scroll',mostrarAnimadoIzqScroll);