$( "#realestate_slide" ).slide_carousel({ element : '.realestate-box-item', breakpoint : [ // >risoluzione minima // | numero di items // | | numero di righe // | | | [ 1199, 3, 1], [ 550, 2, 1], [ 0, 1, 1] ] }); $(window).resize(function() { search_box_position(); }); // lunghezza calcolata al caricamento della pagina e ad ogni resize della schermata var search_box_last_width; var search_box_actual_width = -1; // sposta il box della ricerca prima del corpo principale con risoluzione tablet e smartphone // di lato in modalità desktop function search_box_position() { if ($(window).width() < 992) search_box_actual_width = 991; else search_box_actual_width = 992; if (search_box_last_width != search_box_actual_width) { search_box_last_width = search_box_actual_width; if (search_box_last_width == 991) { var search_box = $('#search-box-left .realestate-search-aside-box').detach(); $('#search-box-top').append(search_box).show(); $('#search-box-left').hide(); } else { var search_box = $('#search-box-top .realestate-search-aside-box').detach(); $('#search-box-left').append(search_box).show(); $('#search-box-top').hide(); } } } $( function() { if ($(window).width() < 992) { search_box_last_width = 10000; search_box_position(); } else { search_box_last_width = 992; } $( "#mq_min" ).change(function() { var max = parseInt($("#mq_max").val()); var min = parseInt($(this).attr('min')); if ($(this).val() > max) $(this).val(max); else if ($(this).val() < min) $(this).val(min); }); $( "#mq_max" ).change(function() { var max = parseInt($(this).attr('max')); var min = parseInt($("#mq_min").val()); if ($(this).val() > max) $(this).val(max); else if ($(this).val() < min) $(this).val(min); }); $( '#order_menu').change(function() { $('#form_order').submit(); }); function formatNumber (num) { if (0 == 0) return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1."); else return num.toFixed(0).toString().replace(/\./g, ",").replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1.").toString(); } function formatCurrency (num) { if (true == true) return formatNumber(num)+" €"; else return "€ "+formatNumber(num); } $( "#realestate-price-slider-range" ).slider({ range: true, min: 0, step: 1000, max: 800000, values: [ 0, 800000 ], slide: function( event, ui ) { $( "#price_min").val(formatCurrency(ui.values[ 0 ])); $( "#price_max").val(formatCurrency(ui.values[ 1 ])); } }); $( "#price_min").val(formatCurrency($( "#realestate-price-slider-range" ).slider( "values", 0 ))); $( "#price_max").val(formatCurrency($( "#realestate-price-slider-range" ).slider( "values", 1 ))); } ); /** ESEMPIO PER UTILIZZO SLIDE // ID della slide // | $( "#slide-example" ).slide_carousel({ element : '.example-item', // elemento contenuto nel carousel breakpoint : [ // numero di elementi e righe in base alla risoluzione // >risoluzione minima // | numero di items // | | numero di righe // | | | [ 1199, 4, 1], [ 768, 2, 1], [ 0, 1, 1] ] }); ***/ $( "#slide" ).slide_carousel({ element : '.slide-item', breakpoint : [ // >risoluzione minima // | numero di items // | | numero di righe // | | | [ 0, 1, 1] ] }); $( "#slide-event" ).slide_carousel({ element : '.event-box-item', // elemento contenuto nel carousel breakpoint : [ // numero di elementi e righe in base alla risoluzione // >risoluzione minima // | numero di items // | | numero di righe // | | | [ 1199, 3, 3], [ 991, 2, 2], [ 768, 2, 1], [ 0, 1, 1] ] }); $( "#slide-event2" ).slide_carousel({ element : '.event-box-item', // elemento contenuto nel carousel breakpoint : [ // numero di elementi e righe in base alla risoluzione // >risoluzione minima // | numero di items // | | numero di righe // | | | [ 768, 3, 3], [ 0, 1, 1] ] }); /** ESEMPIO PER UTILIZZO SLIDE PER LA GALLERY // ID della slide gallery // | $( "#slide-gallery" ).slide_gallery({ element: '.gallery-item', // elemento contenuto nel carousel della gallery w_prop : 4, // proporzione per la lunghezza h_prop : 3, // proporzione per l'altezza debug : false, // debug attivo outer_div : true, // true: non è richiusa all'interno del wrapper, false è rinchiusa all'interno del wrapper ready : true, // true: le immagini carica durante il caricamento della pagina, false al termine del caricamento della pagina breakpoint : [ // numero di elementi in base alla risoluzione // >min-width // | num items // | | numero di righe // | | | margin px // | | | | [ 1199, 4, 1, 10], [ 768, 2, 1, 10], [ 0, 2, 1, 10] ] }); */ $( "#slide-gallery" ).slide_gallery({ element: '.gallery-item', // elemento contenuto nel carousel w_prop : 4, // proporzione per la lunghezza h_prop : 3, // proporzione per l'altezza ready : false, breakpoint : [ // numero di elementi in base alla risoluzione // >min-width // | num items // | | numero di righe // | | | margin px // | | | | [ 1199, 4, 1, 10], [ 767, 3, 1, 10], [ 480, 2, 1, 10], [ 0, 1, 1, 10] ] }); /** ESEMPIO PER L'UTILIZZO DELLE IMMAGINI ADATTATIVE // indicare la classe delle immagini $( ".img-adapter-4-3" ).imgadapter({ w_prop : 4, // proporzione per la lunghezza h_prop : 3, // proporzione per l'altezza outer_div : true, // true: non è richiusa all'interno del wrapper, false è rinchiusa all'interno del wrapper breakpoint : [ // risoluzioni in cui ricalcolare il rapporto // >min-width [ 1400], [ 1200], [ 768], [ 480], [ 0] ] }); ***/ // immagini adattative all'interno del riquadro $( ".img-adapter-in-4-3" ).imgadapter({ w_prop : 4, h_prop : 3, outer_div : false }); $( ".img-adapter-in-1-1" ).imgadapter({ w_prop : 4, h_prop : 3, outer_div : false }); // immagini adattative all'esterno del riquadro $( ".img-adapter-16-9" ).imgadapter({ w_prop : 16, h_prop : 9 }); $( ".img-adapter-4-3" ).imgadapter({ w_prop : 4, h_prop : 3 }); $( ".img-adapter-1-1" ).imgadapter(); /** ESEMPIO PER L'UTILIZZO DELLA GALLERY // indicare la gallery $( ".simple-gallery" ).gallery({ w_prop : 4, // proporzione per la lunghezza h_prop : 3, // proporzione per l'altezza outer_div : true, // true: non è richiusa all'interno del wrapper, false è rinchiusa all'interno del wrapper breakpoint : [ // percentuali da applicare in base alla larghezza minima della pagina // >min-width // | width % // | | margin px // | | | [ 768, 33, 15], [ 480, 50, 15], [ 0, 100, 15] ] }); **/ // margine applicato 15px $( ".simple-gallery-rent" ).gallery({ w_prop : 100, // proporzione per la lunghezza h_prop : 100, // proporzione per l'altezza breakpoint : [ // percentuali da applicare in base alla larghezza minima della pagina // >min-width // | width % // | | margin px // | | | [ 768, 50, 15], [ 0, 100, 15] ] }); $("figure button").click(function(){ var href = $(this).data('href'); window.open(href,'_blank'); }); // funzione di successo per il recaptcha di Google var actual_form = null; function onSuccessRecaptcha(token) { actual_form.submit(); } var clmrecaptchaID = []; var clmrecaptchaFunc = []; var onloadCallback = function() { $('.btn-submit').each(function( index ) { recaptcha_form = $(this).closest("form"); $(this).before('
') }); $('.clm-recaptcha').each(function( index ) { recaptcha_form = $(this).closest("form"); // recupera la callback success per il recaptcha di google del form, // se non esiste mette quella di default if (recaptcha_form.data('gcallback') === undefined) gcallback = onSuccessRecaptcha; else gcallback = window[recaptcha_form.data('gcallback')]; // render il recaptcha clmrecaptchaID[index] = this.id; clmrecaptchaFunc[index] = grecaptcha.render(this.id, { 'sitekey' : '6LdIcRgUAAAAAPqxP2-P1h1HaFM2hVJvcGWHO0hs', 'callback' : gcallback, 'size' : 'invisible' }); }); }; // lunghezza calcolata al caricamento della pagina e ad ogni resize della schermata var actualWidth; $( document ).ready(function() { // pulsante di conferma del form // memorizza il form dell'elemento (utilizzato alla conferma del recaptcha) // effettua la validation HTML5 // se andato a buon fine $('.btn-submit').on('click', function (e) { var error = false; actual_form = $(this).closest("form"); // recupera la classe da applicare in caso di successo var func_check = actual_form.data('check'); if (func_check !== undefined) { var fn = window[func_check]; if (typeof fn === "function") error = fn.apply(null, [this]); } if ( error ) // esco da on click return false; // ricerca il recaptcha del form cmlrecaptcha = actual_form.find('.clm-recaptcha'); cmlrecaptcha_id = -1; for (var i = 0; i < clmrecaptchaID.length; i++) { if (clmrecaptchaID[i] == cmlrecaptcha[0].id) cmlrecaptcha_id = i; } if (typeof actual_form[0].checkValidity != 'undefined' && !actual_form[0].checkValidity()) { } else { e.preventDefault(); // esegue il recaptcha se esiste per il form altrimenti richiama la funzione di successo if (cmlrecaptcha_id != -1) { grecaptcha.reset(clmrecaptchaFunc[cmlrecaptcha_id]); grecaptcha.execute(clmrecaptchaFunc[cmlrecaptcha_id]); } else { if (actual_form.data('gcallback') === undefined) gcallback = onSuccessRecaptcha; else gcallback = window[actual_form.data('gcallback')]; gcallback(); } } }); $('[data-toggle="tooltip"]').tooltip(); $( ".table" ).wrap( "" ); $('.carousel').carousel(); $('.modal').modal('hide'); $('.dropdown-submenu a').click(function(){ if ($(this).next().hasClass('dropdown-menu')) { $('.dropdown-submenu > .dropdown-menu').css('display','block'); return false; } }); //One Animated var is_iOS = ( /iPhone|iPad|iPod/i.test(navigator.userAgent) ); // le animazioni waypoint laterali estendono la pagina causando problemi di visualizzazione nei sistemi operativi IOS // le animazioni waypoint disabilitate if(is_iOS) { $('.animated').css("opacity", "1"); } else { $('.animated').waypoint(function() { var myAnimated = $(this).data('animated'); var oneSomeAnimated = $(this).data('oneanimated'); // animazione da eseguire una singola volta if (oneSomeAnimated == true) { // animazione non e' stata gia' eseguita in tal caso la esegue if (!($(this).hasClass(myAnimated))) $(this).toggleClass($(this).data('animated')).css("opacity", "1"); // animazione da eseguire sempre } else $(this).toggleClass($(this).data('animated')); }, { offset: '80%' }); } // Effect input $(document).on("blur", 'form input, form textarea', function(){ if($(this).val().length !== 0) { $(this).addClass('filled'); } else { $(this).removeClass('filled'); } }); // Effect input $(document).on("blur", 'form input, form textarea, form select', function(){ if($(this).val().length !== 0) { $(this).addClass('filled'); } else { $(this).removeClass('filled'); } }); // visualizza il form per contattare l'autore $("#users-contact").on('click', function(event) { $( '#form_users_ajax' ).toggle(); }); function updateFileList() { var filesToUpload = $(' #filesToUpload ') var fileList = $(' #fileList ').html(''); fileList.html(''); if (filesToUpload[0].files.length == 0) { fileList.append(''+datiJSON.error_code+'
'); $( "#alert-code-"+this.content.id )[0].scrollIntoView(); } else { var fn = window[func_error_code]; if (typeof fn === "function") fn.apply(null, [this, datiJSON, value_class_hide]); } } // azione non legato a risposta positiva if (datiJSON.hasOwnProperty('action')) { switch (datiJSON.action) { case 'refresh': location.reload(); break; } } // risposta positiva if (datiJSON.hasOwnProperty('positive_response')) { if (func_positive_response === undefined) { // action legata a risposta positiva if (datiJSON.hasOwnProperty('action')) { switch (datiJSON.action) { case 'popup': $('#popup_result .response_positive').html(datiJSON.positive_response); $('#popup_result').modal('show'); $( this.content ).find('.star').removeClass('fa-star-chosen').removeClass('fa-star-current').removeClass('fa-star').addClass('fa-star-o'); $( this.content )[0].reset(); return; } } $( this.content ).after('Errore nell\'invio. Riprovare più tardi
'); } else { var fn = window[func_fail]; if (typeof fn === "function") fn.apply(null, [this, data, value_class_hide]); } }); });