1(function fixedHeaderOnScrollDesktop() { 2 var header = document.querySelector(".header"); 3 var main = document.querySelector(".main"); 4 5 var spacer = document.createElement("div"); 6 spacer.classList.add("header-spacer"); 7 8 var blocked; 9 function updateSpacerSize() { 10 if (!blocked) { 11 blocked = true; 12 if (spacer.style) { 13 // Set height once instead of infinite loop 14 spacer.style.height = header.clientHeight + "px"; 15 16 // Unblock after a short delay to allow for multiple rapid calls 17 setTimeout(function () { 18 blocked = false; 19 }, 50); 20 } 21 } 22 } 23 24 var once = false; 25 function fix() { 26 updateSpacerSize(); 27 header.parentNode.insertBefore(spacer, header); 28 header.classList.add("header--fixed"); 29 once = true; 30 } 31 32 function unFix() { 33 header.classList.remove("header--fixed"); 34 if (document.querySelector(".header-spacer")) { 35 header.parentNode.removeChild(spacer); 36 } 37 once = false; 38 } 39 40 function fixHandling() { 41 if (!once) { 42 fix(); 43 } 44 } 45 46 window.addEventListener("scroll", function () { 47 fixHandling(); 48 }); 49 window.addEventListener("resize", function () { 50 fixHandling(); 51 }); 52 document.addEventListener("DOMContentLoaded", function () { 53 fixHandling(); 54 }); 55})();
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.