function equalHeight(group) { var tallest = 0; group.css("height","auto"); group.each(function() { var thisHeight = $(this).height(); if(thisHeight > tallest) { tallest = thisHeight; } }); group.height(tallest); } $(function() { var $root = $('html, body'); $("header a.menu-toggle").on('click', function(){ $("body").addClass("opened-menu"); $(".side-menu").addClass("active"); return false; }); $(".side-menu a.close-toggle").on('click', function(){ $("body").removeClass("opened-menu"); $(".side-menu").removeClass("active"); return false; }); $(document).bind( "mouseup touchend", function(e){ var container = $("header a.menu-toggle, .side-menu"); if (!container.is(e.target) && container.has(e.target).length === 0){ $(".side-menu").removeClass("active"); $("body").removeClass("opened-menu"); } }); $(".side-menu .menu-contents > ul > li.has-dropdown > a.dropdown-toggle").on('click', function(){ $(this).parent().toggleClass("active"); $(this).parent().find("ul").slideToggle(); return false; }); $(".suscribete-btn").on('click', function(){ $(".subsription-form").slideToggle(); return false; }); $("header .header-main").sticky(); setTimeout(function() { $(window).trigger("resize"); }, 250); $('.testimonials-slider').slick({ dots: true, draggable: false, arrows: false, slidesToShow: 1, slidesToScroll: 1 }); var buttonFilters = {}; var buttonFilter; var qsRegex; var $grid = $('.activities-grid').isotope({ layoutMode: 'fitRows', percentPosition: true, itemSelector: '.activity', filter: function() { var $this = $(this); var searchResult = qsRegex ? $this.text().match(qsRegex) : true; var buttonResult = buttonFilter ? $this.is(buttonFilter) : true; return searchResult && buttonResult; } }); $('.filters-holder').on( 'click', 'button', function(event) { var $this = $(this); var $buttonGroup = $this.parents('.activities-filters'); var filterGroup = $buttonGroup.attr('data-filter-group'); buttonFilters[filterGroup] = $this.attr('data-filter'); buttonFilter = concatValues(buttonFilters); $grid.isotope({filter: function() { var $this = $(this); var searchResult = qsRegex ? $this.text().match(qsRegex) : true; var buttonResult = buttonFilter ? $this.is(buttonFilter) : true; return searchResult && buttonResult; }}); }); var $quicksearch = $('.activity-search').keyup( debounce( function() { qsRegex = new RegExp($quicksearch.val(), 'gi'); $grid.isotope({filter: function() { var $this = $(this); var searchResult = qsRegex ? $this.text().match(qsRegex) : true; var buttonResult = buttonFilter ? $this.is(buttonFilter) : true; return searchResult && buttonResult; }}); })); // change is-checked class on buttons $('.activities-filters').each(function(i, buttonGroup){ var $buttonGroup = $(buttonGroup); $buttonGroup.on('click', 'button', function(event) { $buttonGroup.find('.is-selected').removeClass('is-selected'); var $button = $(event.currentTarget); $button.addClass('is-selected'); }); }); /*$(".activities-grid .activity .activity-info .view-more").on('click',function(){ $(this).parent().find(".more-info-wrapper").show(); $(this).remove(); $(window).trigger('resize'); $grid.isotope('layout'); $(window).trigger('resize'); setTimeout(function() { $(window).trigger('resize'); $grid.isotope('layout'); }, 1); return false; });*/ // flatten object by concatting values function concatValues(obj) { var value = ''; for (var prop in obj) { value += obj[prop]; } return value; } function debounce(fn, threshold) { var timeout; threshold = threshold || 100; return function debounced() { clearTimeout( timeout ); var args = arguments; var _this = this; function delayed() { fn.apply( _this, args ); } timeout = setTimeout( delayed, threshold ); }; } setTimeout(function() { $grid.isotope('layout'); $grid.isotope({filter: '*'}); $('.activities-grid').addClass("active"); }, 1000); setTimeout(function() { equalHeight($(".testimonials-slider .testimonial .testimonial-info .testimonial-text")); }, 600); }); if(!Modernizr.touchevents){ var resizeTimer_3; $(window).resize(function() { clearTimeout(resizeTimer_3); resizeTimer_3 = setTimeout(function() { equalHeight($(".testimonials-slider .testimonial .testimonial-info .testimonial-text")); $('.activities-grid').isotope('layout'); }, 200); }); } $(window).bind('orientationchange', function() { equalHeight($(".testimonials-slider .testimonial .testimonial-info .testimonial-text")); });