(function($) { "use strict"; let headerHeight = $('.top-navbar .navbar').outerHeight(); // Select all links with hashes $('.smooth-scroll') // Remove links that don't actually link to anything .not('[href="#"]') .not('[href="#0"]') .click(function(event) { // On-page links if ( location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname ) { // Figure out element to scroll to var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); // Does a scroll target exist? if (target.length) { // Only prevent default if animation is actually gonna happen event.preventDefault(); $('html, body').animate({ scrollTop: target.offset().top - headerHeight }, 1000, function() { // Callback after animation // Must change focus! var $target = $(target); $target.focus(); if ($target.is(":focus")) { // Checking if the target was focused return false; } else { $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable $target.focus(); // Set focus again }; }); } } }); $('#menu-section .menu-tabs-button ul li a').on('click', function(e){ e.preventDefault(); $('#menu-section .menu-tabs-button ul li a').removeClass('active'); $(this).addClass('active'); console.log($(this).attr('data-index')); if($(this).attr('data-index') == '*') { $('#menu-section .menu-tab').show(); } else { $('#menu-section .menu-tab').hide(); $('#menu-section #menu-tab-' + $(this).attr('data-index')).show(); } }) /* .............................................. Loader ................................................. */ $(window).on('load', function() { $('.preloader').fadeOut(); $('#preloader').delay(550).fadeOut('slow'); $('body').delay(450).css({'overflow':'visible'}); }); /* .............................................. Fixed Menu ................................................. */ $(window).on('scroll', function () { if ($(window).scrollTop() > 50) { $('.top-header').addClass('fixed-menu'); } else { $('.top-header').removeClass('fixed-menu'); } }); /* .............................................. Gallery ................................................. */ $('#slides').superslides({ inherit_width_from: '.cover-slides', inherit_height_from: '.cover-slides', play: 5000, animation: 'fade', }); $( ".cover-slides ul li" ).append( "
" ); /* .............................................. Map Full ................................................. */ $(document).ready(function(){ $(window).on('scroll', function () { if ($(this).scrollTop() > 100) { $('#back-to-top').fadeIn(); } else { $('#back-to-top').fadeOut(); } }); $('#back-to-top').click(function(){ $("html, body").animate({ scrollTop: 0 }, 600); return false; }); }); /* .............................................. Special Menu ................................................. */ var Container = $('.container'); Container.imagesLoaded(function () { var portfolio = $('.special-menu'); portfolio.on('click', 'button', function () { $(this).addClass('active').siblings().removeClass('active'); var filterValue = $(this).attr('data-filter'); $grid.isotope({ filter: filterValue }); }); var $grid = $('.special-list').isotope({ itemSelector: '.special-grid' }); }); /* .............................................. BaguetteBox ................................................. */ baguetteBox.run('.tz-gallery', { animation: 'fadeIn', noScrollbars: true }); }(jQuery));