1jQuery( function ($) { 2 3 "use strict"; 4 5 // sticky header 6 if( getbowtied_scripts_vars.sticky_header ) { 7 8 var headerHeight = $('.top-headers-wrapper').length ? $('.top-headers-wrapper').outerHeight() : 0; 9 10 var totalHeaderHeight = $('.site-header').length ? $('.site-header').outerHeight() : 0; 11 12 if( $('#site-top-bar').length ) { 13 totalHeaderHeight += $('#site-top-bar').outerHeight(); 14 } 15 16 $(window).on( 'scroll', function() { 17 if (getbowtied_scripts_vars.mobile_sticky_header) { 18 var that = $('.site-header-sticky'); 19 20 if ( $(this).scrollTop() > totalHeaderHeight ) { 21 $('.st-content').css( 'padding-top', headerHeight-1 ); // -1 fix top-headers-wrapper border-top / margin-top 22 that.addClass('sticky'); 23 } else { 24 that.removeClass('sticky'); 25 $('.st-content').css( 'padding-top', '' ); 26 } 27 } 28 }); 29 } 30 31 // menu dropdown apply scrollbar when longer than the screen 32 if( $('.site-header .main-navigation').length && $('.site-header .main-navigation > ul > li > .sub-menu').length ) { 33 var menu_height = $(window).height() - $('.site-header .main-navigation > ul > li > .sub-menu').offset().top; 34 $('.site-header .main-navigation > ul > li > .sub-menu').each( function () { 35 if( $(this).outerHeight() > menu_height ) { 36 $(this).css( {'max-height': menu_height - 100, 'overflow-y': 'auto' }); 37 } 38 }); 39 } 40 41 // adjust dropdowns' position to avoid offscreen display 42 function adjust_dropdown_position() { 43 if( $(window).width() >= 1024 ) { 44 $('.top-headers-wrapper .main-navigation > ul li.menu-item-has-children').each( function() { 45 46 var submenuWidth = $(this).find('> .sub-menu').outerWidth(); 47 48 var submenuOffset = $(this).find('> .sub-menu').offset().left; 49 var totalSubMenuWidth = submenuWidth + submenuOffset; 50 if ( ( totalSubMenuWidth - $(window).width() ) > 0 ) { 51 if( $(this).hasClass('mega-menu') ) { 52 var position = totalSubMenuWidth - $(window).width(); 53 $(this).find('> .sub-menu').css( 'left', '-' + position + 'px' ); 54 } else { 55 $(this).find('> .sub-menu').addClass('reverse'); 56 } 57 } 58 }); 59 } else { 60 $('.top-headers-wrapper .main-navigation > ul li.menu-item-has-children').each( function() { 61 $(this).children('ul').removeClass('reverse'); 62 if( $(this).hasClass('mega-menu') ) { 63 $(this).children('ul').css( 'left', 0 ); 64 } 65 }); 66 } 67 } 68 69 adjust_dropdown_position(); 70 var resizeTimer; 71 $(window).on( 'resize', function() { 72 clearTimeout(resizeTimer); 73 $('.top-headers-wrapper .main-navigation > ul li.menu-item-has-children.mega-menu > .sub-menu').css( 'left', 0 ); 74 resizeTimer = setTimeout(function() { 75 adjust_dropdown_position(); 76 }, 250); 77 }); 78 79 // close search offcanvas 80 $(document).on('click', '.site-search .close-button', function(){ 81 $(document).find('#offCanvasTop1').removeAttr("style"); 82 }); 83 84 // dropdown levels 85 $('.main-navigation > ul > li').on({ 86 mouseenter: function() { 87 $(this).addClass('active'); 88 }, 89 mouseleave: function() { 90 $(this).removeClass('active'); 91 } 92 }); 93 94 $('.main-navigation > ul > li ul li').on({ 95 mouseenter: function() { 96 clearTimeout($(this).data('timeoutId')); 97 $(this).addClass('active'); 98 }, 99 mouseleave: function() { 100 var that = $(this); 101 var timeoutId = setTimeout( function() { 102 that.removeClass('active'); 103 }, 200); 104 that.data('timeoutId', timeoutId); 105 } 106 }); 107 108});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.