/** * skip-link-focus-fix.js * * Helps with accessibility for keyboard only users. * * Learn more: https://github.com/Automattic/OnePress/pull/136 */ ( function() { var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1, is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1, is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1; if ( ( is_webkit || is_opera || is_ie ) && document.getElementById && window.addEventListener ) { window.addEventListener( 'hashchange', function() { var id = location.hash.substring( 1 ), element; if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { return; } element = document.getElementById( id ); if ( element ) { if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { element.tabIndex = -1; } element.focus(); } }, false ); } })(); /** * Responsive Videos */ ( function() { jQuery('.site-content').fitVids(); })(); /** * Section: Hero Full Screen Slideshow */ ( function() { jQuery(window).on('resize', function (){ var is_transparent = jQuery( 'body').hasClass( 'header-transparent' ); var headerH; var is_top_header = jQuery( '#page > .site-header').length ? true : false; if( is_top_header && ! is_transparent ) { headerH = jQuery('.site-header').height(); } else { headerH = 0; } jQuery('.hero-slideshow-fullscreen').css('height',(jQuery(window).height()-headerH+1)+'px'); }); jQuery(window).trigger( 'resize' ); } )(); /** * Text rotator */ ( function() { jQuery(".js-rotating").Morphext({ // The [in] animation type. Refer to Animate.css for a list of available animations. animation: onepress_js_settings.hero_animation, // An array of phrases to rotate are created based on this separator. Change it if you wish to separate the phrases differently (e.g. So Simple | Very Doge | Much Wow | Such Cool). separator: "|", // The delay between the changing of each phrase in milliseconds. speed: parseInt( onepress_js_settings.hero_speed ), complete: function () { // Called after the entrance animation is executed. } }); } )(); /** * Parallax Section */ ( function() { jQuery(window).resize(function(){ onepressParallax(); }); function onepressParallax() { var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; var testMobile = isMobile.any(); if (testMobile == null) { jQuery( 'body' ).addClass( 'body-desktop') .removeClass( 'body-mobile' ); } else { jQuery( 'body' ).addClass( 'body-mobile' ).removeClass( 'body-desktop' ); } jQuery('.section-has-parallax').each(function() { var $this = jQuery(this); var bg = $this.find('.parallax_bg'); jQuery(bg).css('backgroundImage', 'url(' + $this.data('bg') + ')'); if (testMobile == null) { jQuery(bg).addClass('not-mobile'); jQuery(bg).removeClass('is-mobile'); jQuery(bg).parallax('50%', 0.4); } else { //jQuery(bg).css('backgroundAttachment', 'inherit'); jQuery(bg).removeClass('not-mobile'); jQuery(bg).addClass('is-mobile'); } }); } })(); /** * Reveal Animations When Scrolling */ ( function() { if ( onepress_js_settings.onepress_disable_animation != '1' ) { wow = new WOW( { offset: 50, mobile: false, live: false } ) wow.init(); } })(); /** * Center vertical align for navigation. */ ( function() { if ( onepress_js_settings.onepress_vertical_align_menu == '1' ) { var header_height = jQuery('.site-header').height(); jQuery('.site-header .onepress-menu').css( 'line-height', header_height + "px" ); } })(); /** * Sticky header when scroll. */ ( function( $ ) { if ( onepress_js_settings.onepress_disable_sticky_header != '1' ) { var is_top_header = $( '#page > .site-header').length ? true : false; var p_to_top; $('.site-header').eq(0).wrap( '