/* global musicBandScreenReaderText */ /* * Custom scripts * Description: Custom scripts for nusicBand */ ( function( $ ) { $( function() { //Adding padding top for header to match with custom header $( window ).on( 'load.audioman resize.audioman', function () { if( $( 'body' ).hasClass( 'has-custom-header' ) || $( 'body' ).hasClass( 'absolute-header' )) { headerheight = $('#masthead').height(); //$('.custom-header').css('padding-top', headerheight ); $('.navigation-default #primary-menu-wrapper .menu-inside-wrapper').css('top', headerheight ); } headerheight = $('#masthead').height(); $('#primary-search-wrapper .menu-inside-wrapper').css('top', headerheight ); if( $(window).width() < 1024 ) { $('#primary-menu-wrapper .menu-inside-wrapper' ).css('top', headerheight ); } else { $('#primary-menu-wrapper .menu-inside-wrapper' ).css('top', '' ); } }); // Match Height of Featured Content if ( typeof $.fn.matchHeight === "function" ) { $('#featured-content-section .entry-container, #team-content-section .entry-container').matchHeight(); } // Functionality for scroll to top button $(window).on( 'scroll', function () { if ( $( this ).scrollTop() > 100 ) { $( '#scrollup' ).fadeIn('slow'); $( '#scrollup' ).show(); } else { $('#scrollup').fadeOut('slow'); $("#scrollup").hide(); } }); $( '#scrollup' ).on( 'click', function () { $( 'body, html' ).animate({ scrollTop: 0 }, 500 ); return false; }); // Fit Vid load if ( typeof $.fn.fitVids === "function" ) { $('.hentry, .widget').fitVids(); } }); // Add header video class after the video is loaded. $( document ).on( 'wp-custom-header-video-loaded', function() { $( 'body' ).addClass( 'has-header-video' ); }); /* * Test if inline SVGs are supported. * @link https://github.com/Modernizr/Modernizr/ */ function supportsInlineSVG() { var div = document.createElement( 'div' ); div.innerHTML = ''; return 'http://www.w3.org/2000/svg' === ( 'undefined' !== typeof SVGRect && div.firstChild && div.firstChild.namespaceURI ); } $( function() { $( document ).ready( function() { if ( true === supportsInlineSVG() ) { document.documentElement.className = document.documentElement.className.replace( /(\s*)no-svg(\s*)/, '$1svg$2' ); } }); }); $( '.search-toggle' ).on( 'click', function() { $( this ).toggleClass( 'open' ); $( this ).attr( 'aria-expanded', $( this ).attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); $( '.search-wrapper' ).toggle(); }); /* Menu */ var body, masthead, menuToggle, siteNavigation, socialNavigation, siteHeaderMenu, resizeTimer; function initMainNavigation( container ) { // Add dropdown toggle that displays child menu items. var dropdownToggle = $( '