/*----------------------------------------------------------------------------------- /* /* Init JS /* -----------------------------------------------------------------------------------*/ jQuery(document).ready(function() { $WIN = $(window); /* Preloader * -------------------------------------------------- */ var Preloader = function() { $WIN.on('load', function() { // will first fade out the loading animation $("#loader").fadeOut("slow", function(){ // will fade out the whole DIV that covers the website. $("#preloader").delay(300).fadeOut("slow"); }); }); }; /*----------------------------------------------------*/ /* Flexslider /*----------------------------------------------------*/ $('#intro-slider').flexslider({ animation: 'fade', slideshowSpeed: 4000, animationSpeed: 600, pauseOnHover: true, pauseInvisible: true, controlNav: true, directionNav: true, touch: true, }); $('#about-slider').flexslider({ animation: 'fade', controlNav: true, directionNav: false, touch: true, }); /*----------------------------------------------------*/ /* Adjust Primary Navigation Background Opacity ------------------------------------------------------*/ $(window).on('scroll', function() { var h = $('header').height(); var y = $(window).scrollTop(); var header = $('#main-header'); if ((y > h + 30 ) && ($(window).outerWidth() > 1024 ) ) { header.addClass('opaque'); } else { if (y < h + 30) { header.removeClass('opaque'); } else { header.addClass('opaque'); } } }); /* superfish * -------------------------------------------------- */ var SuperFish = function() { $('ul.sf-menu').superfish({ animation: { height:'show' }, // slide-down effect without fade-in animationOut: { height:'hide'}, // slide-up effect without fade-in cssArrows: false, // disable css arrows delay: 600, // .6 second delay on mouseout speed: 'fast', }); }; /* Mobile Menu ------------------------------------------------------ */ var MobileNav = function() { var toggleButton = $('.menu-toggle'), nav = $('.main-navigation'); toggleButton.on('click', function(event){ event.preventDefault(); toggleButton.toggleClass('is-clicked'); nav.slideToggle(); }); if (toggleButton.is(':visible')) nav.addClass('mobile'); $WIN.resize(function() { if (toggleButton.is(':visible')) nav.addClass('mobile'); else nav.removeClass('mobile'); }); $('#main-nav-wrap li a').on("click", function() { if (nav.hasClass('mobile')) { toggleButton.toggleClass('is-clicked'); nav.fadeOut(); } }); $('#main-nav-wrap > ul.mobile >li.has-children').append('