/* global boldPhotographyOptions */ /* * Custom scripts * Description: Custom scripts for Bold Photography Pro */ ( function( $ ) { $( window ).on( 'load.boldPhotography resize.boldPhotography', function () { // Owl Carousel. if ( typeof $.fn.owlCarousel === "function" ) { // Featured Slider var sliderLayout = 1; var sliderOptions = { rtl:boldPhotographyOptions.rtl ? true : false, autoHeight:true, margin: 0, items: 1, nav: true, dots: true, autoplay: true, autoplayTimeout: 4000, loop: false, responsive:{ 0:{ items:1 }, 640:{ items:( sliderLayout < 2 ) ? sliderLayout : 2 }, 640:{ items:( sliderLayout < 3 ) ? sliderLayout : 3 }, 1024:{ items:( sliderLayout < 4 ) ? sliderLayout : 4 } }, navText: [boldPhotographyOptions.iconNavPrev,boldPhotographyOptions.iconNavNext] }; $(".main-slider").owlCarousel(sliderOptions); // Testimonial Section var testimonialOptions = { rtl:boldPhotographyOptions.rtl ? true : false, autoHeight: true, margin: 0, items: 1, nav: true, dots: true, autoplay: true, autoplayTimeout: 4000, loop: true, responsive:{ 0:{ items:1 }, }, navText: [boldPhotographyOptions.iconNavPrev,boldPhotographyOptions.iconNavNext] }; $( '.testimonial-slider' ).owlCarousel(testimonialOptions); } // Match Height of Featured Content. if ( typeof $.fn.matchHeight === "function" ) { $('#featured-content-section .entry-container').matchHeight(); } /* * Masonry */ if ( $.isFunction( $.fn.masonry ) ) { //Masonry blocks $blocks = $('.grid'); $blocks.imagesLoaded(function(){ $blocks.masonry({ itemSelector : '.grid-item', columnWidth : '.grid-item', // slow transitions transitionDuration: '1s' }); // Fade blocks in after images are ready (prevents jumping and re-rendering) $('.grid-item').fadeIn(); $blocks.find( '.grid-item' ).animate( { 'opacity' : 1 } ); }); $( function() { setTimeout( function() { $blocks.masonry(); }, 2000); }); $(window).resize(function () { $blocks.masonry(); }); } if ( $( 'body' ).hasClass( 'has-custom-header' ) || $( 'body' ).hasClass( 'absolute-header' )) { headerheight = $('#masthead').height(); $('.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', '' ); } }); $( function() { // 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; }); }); // 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 = $( '