/* global photoFocusOptions */ /* * Custom scripts * Description: Custom scripts for Blakely */ ( function( $ ) { $( window ).on( 'load.photoFocus resize.photoFocus', function () { // Owl Carousel. if ( typeof $.fn.owlCarousel === "function" ) { // Featured Slider var sliderOptions = { rtl:photoFocusOptions.rtl ? true : false, autoHeight:true, margin: 0, items: 1, nav: true, dots: true, autoplay: true, autoplayTimeout: 4000, loop: true, responsive:{ 0:{ items:1 }, }, navText: [photoFocusOptions.iconNavPrev,photoFocusOptions.iconNavNext] }; $(".main-slider").owlCarousel(sliderOptions); // Testimonial Section var testimonialOptions = { rtl:photoFocusOptions.rtl ? true : false, autoHeight: true, margin: 0, items: 1, nav: false, dots: true, autoplay: true, autoplayTimeout: 4000, loop: true, responsive:{ 0:{ items:1 }, }, navText: [photoFocusOptions.iconNavPrev,photoFocusOptions.iconNavNext] }; $( '.testimonial-slider' ).owlCarousel(testimonialOptions); } if ( typeof $.fn.masonry === "function" && typeof $.fn.imagesLoaded === "function" ) { /* * 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).on( 'resize', function () { $blocks.masonry(); }); } }); // 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 = $( '