forked from Launch-X-Latam/MisionFrontEnd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlightbox.js
29 lines (25 loc) · 921 Bytes
/
lightbox.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
const imagenes = document.querySelectorAll('.img-galeria')
const imagenesLight = document.querySelector('.agregar-imagen')
const contenedorLight = document.querySelector('.imagen-light')
const hamburguer1 = document.querySelector('.hamburguer');
//console.log(imagenes)
//console.log(imagenesLight)
//console.log(contenedorLight)
imagenes.forEach(imagen =>{
imagen.addEventListener('click', ()=>{
aparecerImagen(imagen.getAttribute('src'))
})
})
contenedorLight.addEventListener('click', (e)=>{
if(e.target !== imagenesLight){
contenedorLight.classList.toggle('show')
imagenesLight.classList.toggle('showImage')
hamburguer1.style.pacity ='1'
}
})
const aparecerImagen = (imagen)=>{
imagenesLight.src = imagen
contenedorLight.classList.toggle('show')
imagenesLight.classList.toggle('showImage')
hamburguer1.style.pacity ='0'
}