(function( $ ) { $(function() { // More code using $ as alias to jQuery // start jquery ////////////////////////////////////////////// function kirheroInitMatchHeight() { // Blog entries $( '.blog-equal-heights .blog-entry-inner' ).matchHeight({ property: 'min-height' }); } $(document).ready(function() { jQuery(".search-header-replace-toggle").click(function() { jQuery('#searchform-header-replace').addClass("show"); }); jQuery("#searchform-header-replace-close").click(function() { jQuery('#searchform-header-replace').removeClass("show"); }); jQuery.navigation.init(); /** * Detect if browser is iPhone or iPad then add body class */ //if ( $( '.hestia-about' ).length > 0 || $( '.hestia-ribbon' ).length > 0 ) { var iOS = /iPad|iPhone|iPod/.test( navigator.userAgent ) && !window.MSStream; if ( iOS ) { jQuery( 'body' ).addClass( 'is-ios' ); } //} kirheroInitMatchHeight(); $('#kirhero-mobile-menu').sidr({ name: 'mobile-sider', //name it speed: '300', side: 'left', //position it source: '#mobile-sider', //add the content close: '#mobile-sider-close', onOpen: function() { $('.site-header').css("left", "300px"); }, onClose: function() { $('.site-header').css("left", "0"); } }); $('.sidr-class-sidr-class-toggle-sidr-close').on("click", function () { $.sidr('close', 'mobile-sider'); }); $(window).resize( function() {960<=$(window).width()&&($.sidr("close","mobile-sider")) } ); $("a[href='#']").on('click', function(event) { if(this.hash == '#' || this.hash =='') { return false; } }); }); // nav (function ( $ ) { $.navigation = { /** * Initialize navigation. */ 'init': function () { this.toggleNavbarTransparency(); }, /** * Toggle navbar transparency */ 'toggleNavbarTransparency': function () { var navbarHome = $( '.site-header' ); if ( navbarHome.length === 0 ) { return; } var transparent = true, headerWithTopbar = 0; if ( navbarHome.hasClass( 'header-with-topbar' ) ) { headerWithTopbar = 80; } if( $( document ).scrollTop() > 0 ) { if ( ($( 'body' ).hasClass( 'home' ) || $( 'body' ).hasClass( 'page' ) ) && $( 'header' ).hasClass( 'header-transparent' ) && $( '.site-header' ).css('position') == 'fixed' ) { navbarHome.removeClass( 'navbar-transparent' ); } } $( window ).on('scroll', function () { //to do if homepage dont has slider ! if ( ($( 'body' ).hasClass( 'home' ) || $( 'body' ).hasClass( 'page' ) ) && $( 'header' ).hasClass( 'header-transparent' ) && $( '.site-header' ).css('position') == 'fixed' ) { if ( $( document ).scrollTop() > headerWithTopbar ) { if ( transparent ) { transparent = false; navbarHome.removeClass( 'navbar-transparent' ); //navbarHome.addClass( 'navbar-not-transparent' ); } } else { if ( !transparent ) { transparent = true; navbarHome.addClass( 'navbar-transparent' ); //navbarHome.removeClass( 'navbar-not-transparent' ); } } } }); } } }( jQuery )); ////////////////////////////////////////////// // end jquery ////////////////////////////////////////////// }); })(jQuery);