praiadeseselle/site/templates/js/main.js

106 lines
2.9 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",
},
});
2023-03-22 17:48:48 +01:00
function getLogin(event)
{
event.preventDefault();
grecaptcha.ready(function()
{
grecaptcha.execute('6LexXqYiAAAAACwDpMGIg1OMnAXVJU0VmbEMQUD8', { action: 'submit' }).then(function(token)
{
var form = document.getElementById("inicio-sesion");
var boton_token = document.createElement('input');
boton_token.type = 'hidden';
boton_token.name = 'token';
boton_token.id = 'token';
boton_token.value = token;
var boton_action = document.createElement('input');
boton_action.type = 'hidden';
boton_action.name = 'action';
boton_action.id = 'action';
boton_action.value = 'submit';
form.appendChild(boton_token);
form.appendChild(boton_action);
form.submit();
});;
});
}
function getContact(event)
{
event.preventDefault();
grecaptcha.ready(function()
{
grecaptcha.execute('6LexXqYiAAAAACwDpMGIg1OMnAXVJU0VmbEMQUD8', { action: 'submit' }).then(function(token)
{
var form = document.getElementById("formulario-contacto");
var boton_token = document.createElement('input');
boton_token.type = 'hidden';
boton_token.name = 'token';
boton_token.id = 'token';
boton_token.value = token;
var boton_action = document.createElement('input');
boton_action.type = 'hidden';
boton_action.name = 'action';
boton_action.id = 'action';
boton_action.value = 'submit';
form.appendChild(boton_token);
form.appendChild(boton_action);
form.submit();
});;
});
}