(($) => { 'use strict'; // adapt header to height function adaptHeight () { var height = $('.top-header').innerHeight(); if ($('header').offset().top > 10) { $('.top-header').addClass('hide'); $('.navigation').addClass('nav-bg'); $('.navigation').css('margin-top','-'+height+'px'); } else { $('.top-header').removeClass('hide'); if ( !$('#top-banner').length) { $('.navigation').removeClass('nav-bg'); } $('.navigation').css('margin-top','-'+0+'px'); } } // load scripts $(window).on('load', () => { $('.preloader').fadeOut(100); adaptHeight(); if ($('#top-banner').length) { $('.navigation').addClass('nav-bg'); $('.hero-section').addClass('hs-banner'); $('.page-title-section').addClass('pts-banner'); } else { $('.hero-section').removeClass('hs-banner'); $('.page-title-section').removeClass('pts-banner'); } }); // sticky menu $(window).scroll(adaptHeight); // hero slider $('.hero-slider').slick({ autoplay: true, autoplaySpeed: 5000, pauseOnFocus: false, pauseOnHover: true, infinite: true, arrows: true, prevArrow: '', nextArrow: '', dots: true }); // venobox popup $(document).ready(() => { $('.vb-video').venobox({ spinner: 'grid' }); $('.vb-gallery').venobox({ selector: '.vb-gallery', numeration: true, infinigall: true, share: true, shareStyle: 'block', spinner: 'grid' }); }); // filter $(document).ready(() => { if ($('.filter-container').length != 0) { const shuffleInstance = new Shuffle($('.filter-container'), { itemSelector: '.filter-item', sizer: '.filter-sizer', delimiter: ',' }); $('.filter-controls li').on('click',() => { $('.filter-controls li').removeClass('active'); $(this).addClass('active'); shuffleInstance.filter($(this).data('filter')) }); } }); // counter $(window).on('scroll', () => { var oTop; if ($('.count').length !== 0) { oTop = $('.count').offset().top - window.innerHeight; } if ($(window).scrollTop() > oTop) { $('.count').each(() => { var $this = $(this), countTo = $this.attr('data-count'); $({ countNum: $this.text() }).animate( { countNum: countTo }, { duration: 1000, easing: 'swing', step: () => $this.text(Math.floor(this.countNum)), complete: () => $this.text(this.countNum) }); }); } }); $(window).on('DOMContentLoaded', () => { if (window.PagefindUI != undefined) { new window.PagefindUI({ element: "#search", translations: { placeholder: "Suchen...", zero_results: "Leider konnten keine Ergebnisse zu [SEARCH_TERM] gefunden werden", clear_search: "Löschen" } }); $('#pagefind-search').on('shown.bs.modal', () => { $('.pagefind-ui__search-input').focus(); }); } }); // enable matomo analytics var _paq = window._paq = window._paq || []; _paq.push(["setDoNotTrack", true]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (() => { var u="https://analytics.cantorgymnasium.de/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); new LazyLoad(); })(jQuery);