1(function ($) { 2 window.init_sticky = function() { 3 4 if ( 0 === $("#header-wrap").length ) { 5 return; 6 } 7 8 var marginTop = 0; 9 // Making theme check happy. 10 var $wpadminbar = $( "#" + "wpadminbar" ); 11 12 // Add the zindex on dom content loaded. 13 $(document).ready(function(){ 14 $wpadminbar.css("z-index", "999999"); 15 }); 16 17 if ( $wpadminbar.length && !$("#topbar-wrap").length) { 18 marginTop = 32; 19 if ($wpadminbar.has("mobile")) { 20 marginTop = 46; 21 } 22 } 23 24 if ($("#header-wrap").is(".header-style-two")) { 25 new Sticky("#nav-full-width", { 26 stickyContainer: "#wrapper", 27 marginTop: marginTop, 28 stickyClass: "sticky", 29 }); 30 } else if ($("#header-wrap").is(".header-style-three")) { 31 new Sticky("#header-wrap", { 32 stickyContainer: "#wrapper", 33 marginTop: marginTop, 34 stickyClass: "sticky", 35 }); 36 } else { 37 new Sticky("#header-wrap", { 38 stickyContainer: "#wrapper", 39 marginTop: marginTop, 40 stickyClass: "sticky", 41 }); 42 } 43 } 44 45 $(function () { 46 47 var masthead_placeholder = $("#header-wrap-placeholder"); 48 var masthead = $("#header-wrap"); 49 var masthead_h = parseInt(masthead.height(), 10); 50 51 if (masthead_h > 0) { 52 masthead_placeholder.css("height", masthead_h + "px"); 53 } 54 if ( typeof ct_sticky_header_config !== "undefined" && "always_sticky" === ct_sticky_header_config.show_type ) { 55 init_sticky(); 56 } 57 58 }); 59 if ( typeof ct_sticky_header_config !== "undefined" && "always_sticky" === ct_sticky_header_config.show_type ) { 60 init_sticky(); 61 } 62 63})(jQuery); 64 65/*-----------------------------------------------------------------------------------*/ 66/* Scroll Up Effect for Sticky Header */ 67/*-----------------------------------------------------------------------------------*/ 68jQuery(document).ready(function($) { 69 70 "use strict"; 71 72 // Bailout if disabled. 73 if ( typeof ct_sticky_header_config !== "undefined" && "always_sticky" === ct_sticky_header_config.show_type ) { 74 return; 75 } 76 77 var lastScrollTop = 0; 78 var scrolledDown = false; 79 var scrolledUp = false; 80 var zIndex = 99990; 81 82 83 // Add offset so it doesnt trigger prematurely. 84 var offset = 0; 85 86 if ( $('#wpadminbar').length !== 0 ) { 87 offset = $('#wpadminbar').height(); 88 } 89 90 // Getting header height. 91 var headerHeight = ($('#header-wrap').height() + offset); 92 93 if ( $('#header-wrap').hasClass('header-style-two') ) { 94 headerHeight = $('#nav-full-width').height() + offset; 95 } 96 97 // Adjust zIndex for transparent header. 98 if ( $('#header-wrap').hasClass('trans-header') ) { 99 zIndex = 99990; 100 // Snap to top for transparent header. 101 $('#header-wrap').css({position: "absolute", width: "100%",left: 0,"z-index": zIndex}).addClass('snap-to-top'); 102 } 103 104 if( $('#header-wrap').hasClass('trans-header') ) { 105 $('#header-wrap').addClass('snap-to-top'); 106 } 107 108 109 window.addEventListener("scroll", function() { 110 111 var st = window.pageYOffset || document.documentElement.scrollTop; 112 113 // Only trigger when scroll top is greater than the height of header + offset. 114 if ( st <= headerHeight ) { 115 116 $('#header-wrap').removeClass('active'); 117 118 if ( $('#header-wrap').hasClass('trans-header') ) { 119 $('#header-wrap').css({position: "absolute", width: "100%",left: 0,"z-index": zIndex}).addClass('snap-to-top');; 120 } else { 121 $('#header-wrap').css({position: "", width: "", left: "", "z-index": "" } ); 122 } 123 124 // Remove sticky class for header style 2. 125 $('#header-wrap').removeClass("sticky"); 126 127 return; 128 } 129 130 if (st > lastScrollTop) { 131 // User is scrolling down. 132 if (!scrolledDown) { 133 $('#header-wrap').removeClass('active snap-to-top').addClass('inactive'); 134 scrolledDown = true; 135 scrolledUp = false; 136 setTimeout(function(){ 137 $('#header-wrap').css({position: "static", width: "100%",left: 0,"z-index": zIndex}); 138 }, 100 ); 139 } 140 } else { 141 // User is scrolling up. 142 if (!scrolledUp) { 143 $('#header-wrap').addClass("sticky"); 144 $('#header-wrap').removeClass('inactive').addClass('active'); 145 $('#header-wrap').css({position: "fixed", width: "100%",left: 0,"z-index": zIndex}); 146 scrolledUp = true; 147 scrolledDown = false;
148 } 149 } 150 151 // For Mobile or negative scrolling. 152 lastScrollTop = st <= 0 ? 0 : st; 153 154 }, false); 155 156});
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.