/////////////////// // PARALLASSI /// /////////////////// // Per il funzionamento dello script è sufficiente assegnare agli // elementi che devono scrollare due "custom data": // data-type="vertical_parallax" // data-speed="1" // Impostando data-speed a "1" lo scorrimento sarà alla stessa velocità // della pagina; sono contemplati anche valori negativi o decimali. // Dichiarazione delle variabili var componentVerifyCycle = 0; var siteApp = { params: { homepage:{ images:[ 'http://www.ariaehotel.it/source/index-1.jpg', 'http://www.ariaehotel.it/source/index-2.jpg', 'http://www.ariaehotel.it/source/index-3.jpg', 'http://www.ariaehotel.it/source/index-4.jpg', 'http://www.ariaehotel.it/source/index-5.jpg' ], images_mobile:[ 'http://cmsmedia.titanka.com/www.ariaehotel.it//crp400x300-index-1.jpg', 'http://cmsmedia.titanka.com/www.ariaehotel.it//crp400x300-index-2.jpg', 'http://cmsmedia.titanka.com/www.ariaehotel.it//crp400x300-index-3.jpg', 'http://cmsmedia.titanka.com/www.ariaehotel.it//crp400x300-index-4.jpg', 'http://cmsmedia.titanka.com/www.ariaehotel.it//crp400x300-index-5.jpg' ] } }, init: function() { if (siteApp.allComponentIsLoaded()) { siteApp.startApplication(); } else { componentVerifyCycle++; if (componentVerifyCycle<200) { setTimeout(function(){siteApp.init();}, 100); } else { return false; } } }, allComponentIsLoaded: function() { var loaded = true; var msg = ''; if (typeof jQuery == 'undefined'){loaded = false; msg += 'jQuery';} if (typeof hs == 'undefined') {loaded = false; msg += 'hs';} if (typeof jQuery().slick == 'undefined') {loaded = false; msg += 'slick';} if (typeof jQuery().imageLightbox == 'undefined') {loaded = false; msg += 'imagelightbox';} if (typeof cms == 'undefined') {loaded = false; msg += 'cms';} if (!loaded) { return false; } else { return true; } }, startApplication: function() { siteApp.applyWebfont(); //siteApp.fadeInHeader(jQuery('#contenuto_206391')); siteApp.fadeInHeader(jQuery('#contenuto_319575')); siteApp.openMenuMobile(); startImageLightBox(); /*cmsPageParams.type == 3 è il valore che ha index*/ /*se sono nella home page carico anche questa funzione*/ if (cmsPageParams.type == 3) { switch(cms.variables.deviceType) { case "phone": //jQuery('#blk_25734').backstretch(siteApp.params.homepage.images_mobile, {duration: 3300, fade: 1250}); jQuery('#blk_46224').backstretch(siteApp.params.homepage.images_mobile, {duration: 3300, fade: 1250}); break; default: //jQuery('#blk_25734').backstretch(siteApp.params.homepage.images, {duration: 3300, fade: 1250}); jQuery('#blk_46224').backstretch(siteApp.params.homepage.images, {duration: 3300, fade: 1250}); } } jQuery('#button_email_min').val(''); jQuery("img").lazyload({ failurelimit : 50, effect : "fadeIn" }); jQuery('.tendina-lingue').click(function() { var lingua = jQuery(this).next(); if (lingua.is(':hidden')) { lingua.slideDown(); } else { lingua.slideUp(); } }); jQuery("#select_lingue").click(function() { jQuery(this).slideUp(); }); jQuery(document).click(function(event) { if(jQuery(event.target).parents('.tendina-lingue').size()|(jQuery(event.target).hasClass('tendina-lingue'))) return; if(!jQuery("#select_lingue").is(':hidden')) jQuery("#select_lingue").fadeOut(250); }); jQuery('.offerte-responsive').slick({ dots: true, infinite: true, arrows: false, speed: 800, fade:false, slidesToShow: 1, slidesToScroll: 1, autoplay: true, autoplaySpeed: 4000 }); jQuery(window).on('scroll load', function() { setTimeout(function() { if (window.innerWidth > 992) { jQuery('.hideme, .shakeme').each( function(i) { var bottom_of_object = jQuery(this).offset().top-200 + jQuery(this).height(); var bottom_of_window = jQuery(window).scrollTop() + jQuery(window).height(); if (bottom_of_window > bottom_of_object) { showMe(this); } }); } }, 300); }); /* adatta altezza contenuti affiancati */ jQuery(window).on('load resize', function() { if (window.innerWidth > 992) { jQuery('.adattHeight').each(function() { $height = jQuery(this).prev().height(); console.log($height) if ($height) { jQuery(this).height($height); } else if (!$height) { $height = jQuery(this).prev().height(); jQuery(this).height($height); } }); } }); cms.onEvent('DatePickerSelected', function(data) { //console.log(data.Tdata); //alert(data.Tdata.monthNumber+' '+data.Tdata.monthText); var id =data.Tdata.element[0].id; switch (id) { case 'arrival': // console.log(data.Tdata); jQuery('.day_formatted').html(data.Tdata.day); jQuery('.ArriveMonth').html(data.Tdata.monthText); break; case 'departure': // console.log(data.Tdata); jQuery('.departday_formatted').html(data.Tdata.day); jQuery('.DepartMonth').html(data.Tdata.monthText); break; } }); cms.onEvent('DatePickerStarted', function(data) { var id =data.Tdata.element[0].id; //alert(data.Tdata.monthNumber+' '+data.Tdata.monthText); switch (id) { case 'arrival': // console.log(data.Tdata); jQuery('.day_formatted').html(data.Tdata.day); jQuery('.ArriveMonth').html(data.Tdata.monthText); break; case 'departure': // console.log(data.Tdata); jQuery('.departday_formatted').html(data.Tdata.day); jQuery('.DepartMonth').html(data.Tdata.monthText); break; } }); cms.onEvent('DatePickerAutoSelectedDeparture', function(data){ var id =data.Tdata.element[0].id; // console.log(data.Tdata); jQuery('.departday_formatted').html(data.Tdata.day); jQuery('.DepartMonth').html(data.Tdata.monthText); }); jQuery('#root_2329 ul.level1').superfish({ delay: 800, // the delay in milliseconds that the mouse can remain outside a submenu without it closing speed: 'normal' // fast, normal }); jQuery( ".opacity" ).animate({ opacity: 1, }, 10); switch (cmsPageParams.relation_code) { case '1446716150': jQuery('#blk_46239').removeClass('col-sm-6 col-md-4').addClass('col-xs-12'); break; case '1446714882': jQuery('#blk_46239').removeClass('col-sm-6 col-md-4').addClass('col-xs-12'); break; case '1446713466': jQuery('#blk_46239').removeClass('col-sm-6 col-md-4').addClass('col-xs-12'); break; case '1446718239': jQuery('#blk_46239').removeClass('col-sm-6 col-md-4').addClass('col-xs-12'); break; } }, // FUNZIONI AD HOC SITO // openMenuMobile: function() { //var $id_menu = '#menu_1609'; var $id_menu = '#menu_2329'; $menu = jQuery($id_menu); $btn = jQuery('.op_block'); jQuery($btn).click(function() { jQuery($id_menu+' .level1').toggleClass('slide-menu'); $btn.parents('.menu-ico').toggleClass('open'); $btn.toggleClass('open'); if (jQuery($id_menu+' .level2').hasClass('slide-menu')) { jQuery($id_menu+' .level2').removeClass('slide-menu') } }); /* creo due div per centrare in verticale le voci di menu */ //jQuery('#menu_1609 .level1>li').wrapAll( "
" ); jQuery('#menu_2329 .level1>li').wrapAll( " " ); jQuery('.cont-menu-centrato').wrap( "" ); /* ******************************************************** */ /* jquery per chiudere la tendina del menu al click esterno alla tendina */ jQuery(document).bind("click touchstart", function(event){ if(jQuery(event.target).parents('.op_block').size()|(jQuery(event.target).hasClass('open'))|(jQuery(event.target).parents('ul#root_2329 li').size() ) ) return; jQuery(".op_block").removeClass('open'); $btn.parents('.menu-ico').removeClass('open'); if(jQuery(".level1").hasClass('slide-menu')) jQuery(".level1").removeClass('slide-menu'); if(jQuery(".level2").hasClass('slide-menu')) jQuery(".level2").removeClass('slide-menu'); }); }, /* ***************gestione tab a fisarmonica*********** */ accordionTab: function(param){ }, /**************** tendina lingue ********************/ openLanguage: function(){ }, applyWebfont: function() { setTimeout(function() { WebFont.load({ google: { families: ['Playfair+Display:400,400italic,700,700italic'] } }); }, 5); }, showMe: function(elem){ }, scrollAnimation: function(){ }, fadeInHeader: function(element){ jQuery(window).scroll(function(){ if(window.innerWidth > 991){ var scrollpos = (document.documentElement.scrollTop || document.body.scrollTop); if(scrollpos > 200){ element.fadeIn(); jQuery('#menu_2330 .level1').css('top','76px'); } else{ element.fadeOut(); jQuery('#menu_2330 .level1').css('top','0'); } } }); } }; siteApp.init(); function add_slide_menu(item) { jQuery('li' + item + ' .level2').toggleClass('slide-menu'); } function back_menu(item) { jQuery('li' + item + ' .level2').toggleClass('slide-menu'); } function showMe(elem){ anim = jQuery(elem).attr('data-anim'); jQuery(elem).addClass('animated '+anim); jQuery(elem).animate({ opacity:1 }, 700, function() { }); } function goToByScroll(param){ jQuery('html, body').animate({scrollTop: jQuery(param).offset().top-200}, 2000, "easeInOutQuad"); } function calcola() { jQuery('#persone').val(jQuery('#adulti').val() + '_' + jQuery('#bambini_3_12').val()); }