1export function initialize(isFixed) 2{ 3 headerFixed(isFixed); 4 mobileNav(); 5} 6function headerFixed(isFixed) 7{ 8 9 if (isFixed == false) 10 return; 11 12 var nav = $('#header_main'); 13 if (!nav.length) return; 14 15 var injectSpace = $('<div />').insertAfter(nav).hide(); 16 17 $(window).on('scroll', function () 18 { 19 if ($(window).scrollTop() > 200) 20 { 21 nav.addClass('is-fixed'); 22 injectSpace.show(); 23 } else 24 { 25 nav.removeClass('is-fixed'); 26 injectSpace.hide(); 27 } 28 if ($(window).scrollTop() > 300) 29 { 30 nav.addClass('is-small'); 31 } else 32 { 33 nav.removeClass('is-small'); 34 } 35 }); 36} 37 38// 2. Mobile Navigation 39function mobileNav() 40{ 41 var wrapMenu = $("#site-header-inner"); 42 var mainNav = $("#main-nav"); 43 var mobileMenu = "main-nav-mobi"; 44 var arrowHtml = '<span class="arrow"></span>'; 45 var mobile = window.matchMedia("(max-width: 991px)"); 46 47 handleResponsive(mobile); 48 mobile.addListener(handleResponsive); 49 50 function handleResponsive(mq) 51 { 52 if (mq.matches) 53 { 54 if (!$("#" + mobileMenu).length) 55 { 56 mainNav 57 .attr("id", mobileMenu) 58 .appendTo("#header_main") 59 .hide() 60 .find("li:has(ul)") 61 .children("ul").hide() 62 .before(arrowHtml); 63 } 64 } else 65 { 66 $("#" + mobileMenu) 67 .attr("id", "main-nav") 68 .removeAttr("style") 69 .prependTo(wrapMenu) 70 .find(".sub-menu").removeAttr("style") 71 .prev(".arrow").remove(); 72 73 $(".mobile-button").removeClass("active"); 74 } 75 } 76 77 $(document).on("click", ".mobile-button", function () 78 { 79 $(this).toggleClass("active"); 80 $("#" + mobileMenu).slideToggle(); 81 }); 82 83 $(document).on("click", "#" + mobileMenu + " .arrow", function (e) 84 { 85 $(this).toggleClass("active").next().slideToggle(); 86 e.preventDefault(); 87 }); 88} 89export function dispose() 90{ 91 // Any cleanup needed 92}
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.