var $root = $('html, body');
/*
window.addEventListener("orientationchange", function() {
console.log("cambia");
window.location.reload();
}); */
function infoAggiornate(e) {
swal({
type: 'success',
text: e,
timer: 1500,
showConfirmButton: false
})
};
if ($("#contattiForm").length > 0) {
$.datetimepicker.setLocale('it');
$('#datetimepicker5').datetimepicker({
inline:true,
lang: 'it',
format: 'Y-m-d H:i',
formatTime: 'H:i',
dayOfWeekStart: 1,
formatDate: 'Y-m-d',
disabledWeekDays:[0,1],
defaultDate: new Date(),
defaultTime:'10:00',
allowTimes:[
'09:30',
'10:00',
'10:30',
'11:00',
'11:30',
'15:30',
'16:00',
'16:30',
'17:00',
'17:30',
'18:00',
'18:30'
]
});
// 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: "AVVISO_ERRORE",
text: "AVVISO_ERRORE_CAMPI_OBBLIGATORI",
type: "error",
showConfirmButton: true
});
}).on('form:submit', function () {
$('#contattiForm').find('button[type=submit]').prop('disabled', true);
grecaptcha.execute('6LeOK_AqAAAAADp4vNL1LBbiysYZ9ARLUEkrIuCY', {action: 'homepage'})
.then(function (token) {
// add token to form
document.getElementById('g-recaptcha-response').value = token;
form = $('#contattiForm');
$.ajax({
url: "https://www.idwitalia.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.idwitalia.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;
});
});
}
//$('#form_daterangepicker').daterangepicker({
// //isInvalidDate: function(date) {
// // var dateRanges = prenotazioni;
// // return dateRanges.reduce(function(bool, range) {
// // return bool || (date >= range.start && date <= range.end);
// // }, false);
// //},
// singleDatePicker: true,
// timePicker: true,
// showDropdowns: true,
// minTime: '09:00:00',
// maxTime: '16:00:00',
// startDate: moment().startOf('hour').add(24, 'hour'),
// endDate: moment().startOf('hour').add(48, 'hour'),
// minDate: moment().startOf('hour').add(24, 'hour'),
// firstDay: 0,
// locale: {
// "format": "DD/MM/YYYY",
// "separator": " - ",
// "applyLabel": "Conferma",
// "cancelLabel": "Cancella",
// "fromLabel": "Da",
// "toLabel": "Fino al",
// "customRangeLabel": "Custom",
// "daysOfWeek": [
// "Dom",
// "Lun",
// "Mar",
// "Mer",
// "Gio",
// "Ven",
// "Sab"
// ],
// "monthNames": [
// "Gennaio",
// "Febbraio",
// "Marzo",
// "Aprile",
// "Maggio",
// "Giugno",
// "Luglio",
// "Agosto",
// "Settembre",
// "Ottobre",
// "Novembre",
// "Dicembre"
// ],
// }
//}, function (start) {
// $("#form_daterangepicker .form-control").val(start.format("DD-MM-YYYY hh:mm A"));
//});
$(document).ready(function () {
if ($("#rev_slider_1078_1").revolution == undefined) {
revslider_showDoubleJqueryError("#rev_slider_1078_1");
} else {
$("#rev_slider_1078_1").show().revolution({
sliderType: "standard",
jsFileLocation: "https://www.idwitalia.com/assets/plugins/revolution/js/",
sliderLayout: "fullscreen",
dottedOverlay: "none",
delay: 9000,
navigation: {
keyboardNavigation: "on",
keyboard_direction: "horizontal",
mouseScrollNavigation: "off",
mouseScrollReverse: "default",
onHoverStop: "off",
touch: {
touchenabled: "on",
swipe_threshold: 75,
swipe_min_touches: 1,
swipe_direction: "horizontal",
drag_block_vertical: false
}
,
arrows: {
style: "zeus",
enable: true,
hide_onmobile: true,
hide_under: 600,
hide_onleave: true,
hide_delay: 200,
hide_delay_mobile: 1200,
tmp: '',
left: {
h_align: "left",
v_align: "center",
h_offset: 30,
v_offset: 0
},
right: {
h_align: "right",
v_align: "center",
h_offset: 30,
v_offset: 0
}
}
,
bullets: {
enable: true,
hide_onmobile: false,
hide_under: 300,
style: "hermes",
hide_onleave: false,
hide_delay: 200,
hide_delay_mobile: 1200,
direction: "horizontal",
h_align: "center",
v_align: "bottom",
h_offset: 0,
v_offset: 30,
space: 8,
tmp: ' {{title}}'
}
},
viewPort: {
enable: true,
outof: "pause",
visible_area: "80%",
presize: false
},
responsiveLevels: [1240, 1024, 778, 480],
visibilityLevels: [1240, 1024, 778, 480],
gridwidth: [1240, 1024, 778, 480],
gridheight: [600, 600, 500, 400],
lazyType: "single",
parallax: {
type: "mouse",
origo: "slidercenter",
speed: 2000,
levels: [2, 3, 4, 5, 6, 7, 12, 16, 10, 50, 46, 47, 48, 49, 50, 55]
},
shadow: 0,
spinner: "off",
stopLoop: "off",
stopAfterLoops: -1,
stopAtSlide: -1,
shuffle: "off",
autoHeight: "off",
hideThumbsOnMobile: "off",
hideSliderAtLimit: 0,
hideCaptionAtLimit: 0,
hideAllCaptionAtLilmit: 0,
debugMode: false,
fallbacks: {
simplifyAll: "off",
nextSlideOnWindowFocus: "off",
disableFocusListener: false
}
});
}
});
$(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);
}
}
});
$(".toSecondSlide").click(function() {
var heightMenu = $('nav').height();
$('html, body').animate({scrollTop: $('#scrollHere').offset().top -60 }, '600');
})
$(window).on("load", function() {
if($(window).width()>991) {
e=0;
$(".js-eq-altezza").each(function() {
console.log($(this).height());
$(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)
}
});