1(function($) { 2 3 4 // Header event handling (on scroll etc.) 5 var header = $('header.site-header'), 6 headerBar1 = header.find('.header-bar-1'), 7 headerBar2 = header.find('.header-bar-2'), 8 limit = 1; 9 headerAnimationDuration = 500; 10 11 function headerOnScroll(initial) { 12 initial = (typeof initial !== 'undefined') ? initial : false; 13 14 var offset = $(document).scrollTop(); 15 var duration = headerAnimationDuration; 16 if(initial) duration = 0; 17 var keepScrolled = false; 18 19 if($(window).outerWidth() <= 1024) { 20 if($('body').hasClass('no-header-overlay')) { 21 if(initial) { 22 keepScrolled = true; 23 } else { 24 return; 25 } 26 } 27 } 28 29 if($(window).outerWidth() <= 1024) { 30 headerBar1.fadeOut(duration); 31 headerBar2.fadeOut(duration); 32 return; 33 } 34 35 if(offset >= limit) { 36 headerBar1.fadeIn(duration); 37 headerBar2.fadeOut(duration); 38 } else { 39 headerBar1.fadeOut(duration); 40 headerBar2.fadeIn(duration); 41 } 42 } 43 44 $(window).on('scroll resize orientationChange', function() { 45 headerOnScroll(); 46 }); 47 headerOnScroll(true); 48 49 50 // Menu event handling 51 $('body').on('click', '.mobile-menu', function(e) { 52 e.stopPropagation(); 53 }) 54 .on('click', '.mobile-menu li a', function(e) { 55 e.stopPropagation(); 56 }) 57 .on('click', '.mobile-menu li.menu-item-has-children', function(e) { 58 $(this).toggleClass('submenu-open'); 59 }) 60 .on('click', '.mobile-menu-trigger', function(e) { 61 if(!$(this).hasClass('mobile-menu-visible')) { 62 openCloseMobileMenu(true); 63 } else { 64 openCloseMobileMenu(false); 65 } 66 e.stopPropagation(); 67 }) 68 .on('click', function(e) { 69 openCloseMobileMenu(false); 70 }); 71 72 function openCloseMobileMenu(open) { 73 open = (typeof open !== 'undefined') ? open : true; 74 75 if(open) { 76 $('.mobile-menu').show().removeClass('hidden').addClass('visible'); 77 $('.mobile-menu-trigger').removeClass('mobile-menu-hidden').addClass('mobile-menu-visible'); 78 $('body').css('overflow', 'hidden'); 79 } else { 80 $('.mobile-menu').removeClass('visible').addClass('hidden'); 81 $('.mobile-menu-trigger').removeClass('mobile-menu-visible').addClass('mobile-menu-hidden'); 82 $('body').css('overflow', 'auto'); 83 } 84 } 85 86 87})(jQuery);
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.