/************************************************************************** GLOBAL VARIABLES **************************************************************************/ var cache = []; var dyn_search; var dim = { ww : $(window).width(), wh : $(window).height(), cacheww : $(window).width(), cachewh : $(window).height()}; window.cookieconsent_options = { message:'Questo sito NON utilizza cookie di profilazione. Sono utilizzati soltanto cookie tecnici e di terze parti legati all’uso di Google Analytics (IP anonimo) e all’eventuale presenza di "Social plugin". Proseguendo la navigazione del sito acconsenti all’uso dei cookie. Per maggiori informazioni leggi l’informativa estesa dove sono specificate le modalità per configurali o disattivarli.', learnMore: 'Informativa estesa', dismiss: 'Chiudi', link: 'http://www.comune.fe.it/index.phtml?id=3177', theme: 'http://www.comune.fe.it/style/cookiepolicy.css' }; (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-12225891-9', 'auto'); ga('set', 'anonymizeIp', true); ga('send', 'pageview'); /************************************************************************** GLOBAL EVENT LISTENERS FUNCTIONS **************************************************************************/ function ready() { dynsearch = new dynamic_search(); $('.slider').slick({ slide: 'li', dots: false, arrows: false, autoplay: true, autoplaySpeed: 10000, speed: 1000, draggable: false, infinite: true, fade: true, //responsive: [{ breakpoint : 520, settings : "unslick" }] }); navigathor(); asideNav(); $('header nav .search > a').click(function(){ $(this).parent().toggleClass('open'); }); /* $('header nav .search > .fields a.button').click(function(e){ e.preventDefault(); location.href = "index.php?id=729&keywords="+$('header nav .search > .fields input').val(); }); */ burgerNav('header nav', 'right'); $(window).scroll(function(){ if($(this).scrollTop() > 90) $('header p a').addClass('moveUp') else $('header p a').removeClass('moveUp') }); // Pulisci codice cataloghi priscilla if (!$('div.priscillaskin').length) { $('section.news article img').attr('style', ''); $('div.priscillacatalog img').attr('style', ''); $('div.priscillacatalog').next('div[style^="clear"]').remove(); $('div.priscillacatalog>div>a').remove(); $('div.priscillacatalog div[style^="clear"]').remove(); $('div.priscillacatalog>div').unwrap().children().unwrap(); $('div.priscillacatalog>div').unwrap().children().unwrap(); $('p.catalogo:contains("immagine non disponibile")').remove(); } $('.colorbox').colorbox({title: function(){return $('img', this).attr('alt');}}); } function load() { $('.card').height(calcHeight('.card .front .content', 0)); } function resize() { dim.cacheww = dim.ww; dim.cachewh = dim.wh; dim.ww = $(window).width(); dim.wh = $(window).height(); } /************************************************************************** ASIDE NAV **************************************************************************/ function asideNav(){ var _controller = $('Menu Associazione').prependTo('aside nav'); _controller.click(function(){ $(this).toggleClass('active').next('ul').slideToggle(); }); $(window).resize(function(){ if(dim.ww > 760) _controller.next('ul').show(); else _controller.removeClass('active').next('ul').hide(); }) } /************************************************************************** BURGER NAV - nav : element annidation (not as an object) - position: left or right **************************************************************************/ function burgerNav(nav, position){ var _nav = $(nav); var _burgerIcon = $('').prependTo(_nav); var _overlay = $('
').appendTo(_nav); _burgerIcon.click(function(e){ e.preventDefault(); _nav.toggleClass('active'); _overlay.fadeToggle(); }); _overlay.click(close); $(window).resize(function(){ if(dim.ww != dim.cacheww) close(); }); function close(){ _nav.removeClass('active'); _overlay.fadeOut(); } //swipe var swipeEl = new Hammer(document.getElementsByTagName('html')[0],{ cssProps: {userSelect: true}}); swipeEl.on("swipeleft swiperight", function(ev) { if ( ev.type == ((position == 'right') ? 'swiperight' : 'swipeleft' ) && _nav.hasClass('active') || ev.type == ((position == 'right') ? 'swipeleft' : 'swiperight' ) && !_nav.hasClass('active') ) _burgerIcon.trigger('click') }); } /************************************************************************** FUNCTIONS **************************************************************************/ function navigathor(){ $('aside nav > ul > li > a').click(function(){ $(this).toggleClass('selected').siblings('ul').slideToggle(); $(this).parent().siblings().children('a').removeClass('selected').siblings('ul').slideUp(); }); } function dynamic_search(){ var input_name = $('input#nome'), input_select = $('select#categorie'), list = $('#list li.resultListElement'); this.checker = function(e){ var array_value_name = input_name.val().split(' '), value_cat = input_select.val(), match_nome, match_cat; $('.card').addClass('flipped'); list.each(function(){ var title = $(this).children('strong').text(); var categories = []; $(this).find('.aree .tareas li').each(function() { categories.push($(this).text()) }); match_nome = 0; match_cat = false; for( var i = 0; i < array_value_name.length; i++){ if( title.toLowerCase().indexOf( array_value_name[i].toLowerCase() ) > -1 ){ match_nome++; } } if( input_select[0].selectedIndex != 0 ){ for( var i = 0; i < categories.length; i++){ if( categories[i].toLowerCase() == value_cat.toLowerCase() ){ match_cat = true; } } }else{ match_cat = true; } if( match_nome == array_value_name.length && match_cat == true ) $(this).show(); else $(this).hide(); }); $('.card').height(calcHeight('.card .back .content', 0)); } input_select.on('change',function(){ $(this).next('span').text($(this).find(":selected").text()); }); $('.card .goBack').click(function(){ $('.card').removeClass('flipped').height(calcHeight('.card .front .content', 0)); input_name.val(''); input_select.val( input_select.find('option:first').val() ).next('span').text( input_select.find('option:first').val() ); }); list.click(function(){ $(this).siblings().find('.expandable').slideUp(); $(this).find('.expandable').slideToggle(function(){ $('.card').height(calcHeight('.card .back .content', 0)); }); }) input_name.focusin(function(){ $('.searchForm').addClass('focused'); }); input_name.focusout(function(){ $('.searchForm').removeClass('focused'); }); input_select.focusin(function(){ $('.searchForm').addClass('focused'); }); input_select.focusout(function(){ $('.searchForm').removeClass('focused'); }); input_name.keyup(this.checker); input_select.change(this.checker); input_name.on('keypress',function(e){ if(e.which == 13 ) $('html, body').stop().animate({scrollTop : $('.card').position().top }) }); $(window).on('resize',function(){ if ( $('.card').hasClass('flipped') ) $('.card').height(calcHeight('.card .back .content', 0)); else $('.card').height(calcHeight('.card .front .content', 0)); }); } function calcHeight(container, offset){ var h = 0; $(container).children().each(function(){ h += $(this).outerHeight(true) + offset; }) return h; } /************************************************************************** PLUGINS **************************************************************************/ /*! Hammer.JS - v2.0.4 - 2014-09-28 * http://hammerjs.github.io/ * * Copyright (c) 2014 Jorik Tangelder; * Licensed under the MIT license */ !function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(k(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e