praiadeseselle/site/templates/js/main.js

52 lines
1.2 KiB
JavaScript

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",
},
});