praiadeseselle/site/templates/js/main.js

61 lines
1.7 KiB
JavaScript
Raw Normal View History

function abrirMenu()
2023-02-21 14:48:37 +01:00
{
document.getElementById("menu-despregable").classList.add("despregado");
}
function pecharMenu()
2023-02-21 14:48:37 +01:00
{
document.getElementById("menu-despregable").classList.remove("despregado");
}
2023-02-21 14:48:37 +01:00
const swiper_galeria = new Swiper(".galeria",
2023-02-21 14:48:37 +01:00
{
allowTouchMove: false,
2023-02-21 14:48:37 +01:00
slidesPerView: 1,
spaceBetween: 0,
2023-02-21 14:48:37 +01:00
loop: true,
autoHeight: false,
centeredSlides: true,
keyboard:
2023-02-21 14:48:37 +01:00
{
enabled: true,
onlyInViewport: false,
},
autoplay: false,
/*{
2023-02-21 14:48:37 +01:00
delay: 2500,
disableOnInteraction: false,
pauseOnMouseEnter: true,
},*/
2023-02-21 14:48:37 +01:00
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';
}
});