praiadeseselle/site/templates/js/main.js

53 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-02-21 14:48:37 +01:00
document.addEventListener("click", function (e)
{
if(e.target.classList.contains("reixa-item"))
{
const src = e.target.getAttribute("src");
const alt = e.target.getAttribute("alt");
const myModal = new bootstrap.Modal(document.getElementById("reixa-modal"))
document.querySelector(".modal-img").src = src;
document.querySelector(".modal-label").innerHTML = alt;
myModal.show();
}
});
document.addEventListener("show.bs.collapse", function (e)
{
e.target.previousElementSibling.classList.add("active");
});
document.addEventListener("hide.bs.collapse", function (e)
{
e.target.previousElementSibling.classList.remove("active");
});
const swiper_galeria = new Swiper("#galeria",
{
slidesPerView: 1,
spaceBetween: 30,
loop: true,
lazy: true,
autoHeight: false,
keyboard: true,
centeredSlides: true,
autoplay:
{
delay: 2500,
disableOnInteraction: false,
pauseOnMouseEnter: true,
},
pagination:
{
el: ".swiper-pagination",
clickable: true,
},
navigation:
{
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
});