var $root = $('html, body');
//$(window).on('load', function() {
// if (window.location.hash && $(window.location.hash).length > 0) {
// if ($(window).width() > 1024) {
// $root.animate({
// scrollTop: $(window.location.hash).offset().top - 60
// }, 600);
// }
// else {
// $root.animate({
// scrollTop: $(window.location.hash).offset().top - 60
// }, 600);
// }
// }
//});
function infoAggiornate(e) {
swal({
type: 'success',
text: e,
timer: 1500,
showConfirmButton: false
})
};
$( '.fancy' ).fancybox({
thumbs : {
autoStart : true,
axis: "y" // Vertical (y) or horizontal (x) scrolling
},
// Enable keyboard navigation
keyboard: true,
slideShow: {
autoStart: false,
speed: 3000
}
});
if ($("#contattiForm").length > 0) {
// needs for recaptacha ready
grecaptcha.ready(function () {
// do request for recaptcha token
// response is promise with passed token
$('#contattiForm').parsley().on('form:error', function () {
swal({
title: "Errore",
text: "Per procedere รจ necessario completare tutti i campi obbligatori",
type: "error",
showConfirmButton: true
});
}).on('form:submit', function () {
$('#contattiForm').find('button[type=submit]').prop('disabled', true);
grecaptcha.execute('6Leq-o0iAAAAADvJxxE1yp9nRVnam2NXJHk5N-Uk', {action: 'homepage'})
.then(function (token) {
// add token to form
document.getElementById('g-recaptcha-response').value = token;
form = $('#contattiForm');
$.ajax({
url: "https://www.de-martini.com/assets/ajax/invia-mail.php",
type: "POST",
data: form.serialize(),
success: function (data) {
if (data.status == "success") {
infoAggiornate(data.message);
setTimeout(function () {
window.location = 'https://www.de-martini.com'
}, 2000);
}
else if (data.status == "error") {
$('#contattiForm').find('button[type=submit]').prop('disabled', false);
swal({
title: "Errore",
text: data.message,
type: "error",
showConfirmButton: true
});
return false;
}
},
});
});
return false;
});
});
}
$(window).on("load", function() {
if($(window).width()>768) {
e=0;
$(".js-eq-altezza").each(function() {
$(this).height()>e&&(e=$(this).height())
}
), $(".js-eq-altezza").height(e)
}
if($(window).width()>768) {
e=0;
$(".js-eq-altezza-2").each(function() {
$(this).height()>e&&(e=$(this).height())
}
), $(".js-eq-altezza-2").height(e)
}
});