praiadeseselle/site/templates/js/main.js

61 lines
No EOL
1.7 KiB
JavaScript

function abrirMenu()
{
document.getElementById("menu-despregable").classList.add("despregado");
}
function pecharMenu()
{
document.getElementById("menu-despregable").classList.remove("despregado");
}
const swiper_galeria = new Swiper(".galeria",
{
allowTouchMove: false,
slidesPerView: 1,
spaceBetween: 0,
loop: true,
autoHeight: false,
centeredSlides: true,
keyboard:
{
enabled: true,
onlyInViewport: false,
},
autoplay: false,
/*{
delay: 2500,
disableOnInteraction: false,
pauseOnMouseEnter: true,
},*/
pagination:
{
el: ".swiper-pagination",
clickable: true,
},
navigation:
{
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
freeMode: false,
});
document.addEventListener("click", function (e)
{
if(e.target.classList.contains("reixa-item") && window.matchMedia("(min-width: 768px)"))
{
document.body.classList.toggle('noscroll', true);
document.querySelector(".modal").setAttribute('aria-hidden', false);
document.querySelector(".modal").style.display = 'block';
document.querySelector(".modal-imaxe").src = e.target.src;
document.querySelector(".modal-imaxe").alt = e.target.alt;
document.querySelector(".modal-descripcion").textContent = e.target.alt;
}
if(e.target.classList.contains("modal-pechar") && window.matchMedia("(min-width: 768px)"))
{
document.body.classList.toggle('noscroll', false);
document.querySelector(".modal").setAttribute('aria-hidden', true);
document.querySelector(".modal").style.display = 'none';
}
});