1$(document).ready(function() { 2 var enable = jQuery("#enable-sticky-nav").attr("data-sticky-nav") 3 // don't stick the navigation when user is logged in 4 5 if (jQuery("body").hasClass("logged-in")) { 6 throw "User is logged-in. Sticky nav has been disabled." 7 } else if (enable === "TRUE") { 8 // create object to collect header info in 9 var headerInfo = { 10 rows: undefined, 11 cellsPerRow: {}, 12 menu: { 13 exists: false, 14 rowPos: undefined, 15 cellPos: undefined, 16 height: undefined, 17 cssSelector: undefined 18 }, 19 carrousel: { 20 exists: false, 21 rowPos: undefined, 22 cellPos: undefined, 23 height: undefined, 24 cssSelector: undefined 25 }, 26 logo: { 27 exists: false, 28 rowPos: undefined, 29 cellPos: undefined, 30 height: undefined, 31 cssSelector: undefined 32 } 33 } 34 var rowCounter = 0 35 var cellCounter = 0 36 37 var checkheaderobject = function() { 38 // loop through each row to check it's content 39 jQuery("#nxs-header-container > .nxs-postrows") 40 .children() 41 .each(function() { 42 cellCounter = 0 43 // loop through each cell in the row if widgets are set in that row 44 jQuery(".nxs-placeholder-list", this) 45 .children() 46 .each(function() { 47 // if the widget is the logo widget; update headerInfo 48 if (jQuery(".nxs-widget", this).hasClass("nxs-logo")) { 49 jQuery( 50 "#nxs-header-container > .nxs-postrows > .nxs-row:eq(" + 51 rowCounter + 52 ")" 53 ).addClass("nxs-stickynav-logo-row") 54 headerInfo.logo.exists = true 55 headerInfo.logo.height = jQuery( 56 "#nxs-header-container > .nxs-postrows > .nxs-row:eq(" + 57 rowCounter + 58 ")" 59 ).height() 60 headerInfo.logo.imgheight = jQuery( 61 "#nxs-header-container > .nxs-postrows > .nxs-row:eq(" + 62 rowCounter + 63 ") .nxs-logo .logo-image img" 64 ).height() 65 headerInfo.logo.rowPos = rowCounter 66 headerInfo.logo.cellPos = cellCounter 67 headerInfo.logo.cssSelector = ".nxs-stickynav-logo-row" 68 } else if (jQuery(".nxs-widget", this).hasClass("nxs-menu")) { 69 // if the widget is the menu widget; update headerInfo 70 jQuery( 71 "#nxs-header-container > .nxs-postrows > .nxs-row:eq(" + 72 rowCounter + 73 ")" 74 ).addClass("nxs-stickynav-menu-row") 75 headerInfo.menu.exists = true 76 headerInfo.menu.height = jQuery( 77 "#nxs-header-container > .nxs-postrows > .nxs-row:eq(" + 78 rowCounter + 79 ")" 80 ).height() 81 headerInfo.menu.rowPos = rowCounter 82 headerInfo.menu.cellPos = cellCounter 83 headerInfo.menu.cssSelector = ".nxs-stickynav-menu-row" 84 } else if ( 85 jQuery(".nxs-widget > div > div", this).hasClass("carrousel-custom") 86 ) { 87 // if the widget is the html widget with the carrousel in it; update headerInfo 88 jQuery( 89 "#nxs-header-container > .nxs-postrows > .nxs-row:eq(" + 90 rowCounter + 91 ")" 92 ).addClass("nxs-stickynav-carrousel-row") 93 headerInfo.carrousel.exists = true 94 headerInfo.carrousel.height = jQuery( 95 "#nxs-header-container > .nxs-postrows > .nxs-row:eq(" + 96 rowCounter + 97 ")" 98 ).height() 99 headerInfo.carrousel.rowPos = rowCounter 100 headerInfo.carrousel.cellPos = cellCounter 101 headerInfo.carrousel.cssSelector = ".nxs-stickynav-carrousel-row" 102 } 103 cellCounter++ 104 headerInfo.cellsPerRow[rowCounter] = cellCounter 105 }) 106 rowCounter++ 107 headerInfo.rows = rowCounter 108 }) 109 // if the menu is not present in the header; cannot stick the navigation 110 if (!headerInfo.menu.exists) { 111 throw "No menu present in the header. Sticky nav is disabled" 112 } 113
114 /* headerInfo is now an object containing the amount of rows in the header, the amount of widgets per row, 115 ** whether the menu, logo and carrousel widgets exist as well as the row number, widget number in the row 116 ** and height of each of those 3 widgets. */ 117 118 if ($("#nxs-header .nxs-menu").length > 0) { 119 var nxsMenuHeight = $("#nxs-header .nxs-menu") 120 .closest(".nxs-row ") 121 .height() 122 console.log("nxsMenuHeight = " + nxsMenuHeight) 123 } 124 125 if ($("#nxs-header .nxs-logo a").length > 0) { 126 var logopos = $("#nxs-header .nxs-logo a") 127 var logoYpos = logopos.offset() 128 129 //logopos.css({display:"none"}) 130 console.log("logoYpos = " + logoYpos.top) 131 } 132 133 134 135 if (headerInfo.logo.exists && logoYpos.top == 0) { 136 console.log("logoYpos top = " + logoYpos.top) 137 138 $("#nxs-header .stop-absolute960.nxs-absolute img").css({ 139 "max-height": nxsMenuHeight - 10, 140 height: nxsMenuHeight - 10, 141 top: 5, 142 position: "absolute" 143 }) 144 var nxsDevLogoPos = $("#nxs-header .nxs-logo a").position() 145 146 147 148 } else if (headerInfo.logo.exists) { 149 150 console.log("logoYpos header = " + logoYpos.top) 151 var nxsDevLogoHeight = headerInfo.logo.imgheight 152 $("#nxs-header .stop-absolute960.nxs-absolute img").css({ 153 "max-height": nxsDevLogoHeight - 10, 154 height: nxsDevLogoHeight - 10, 155 top: 5, 156 position: "absolute" 157 }) 158 var nxsDevLogoPos = $("#nxs-header .nxs-logo a").position() 159 } 160 161 $(headerInfo.logo.cssSelector) 162 .first() 163 .on("sticky-start", function() { 164 $("#nxs-header .nxs-logo img").css({ 165 "max-height": nxsMenuHeight - 10, 166 height: nxsMenuHeight - 10, 167 "margin-top": 0, 168 position: "absolute" 169 }) 170 $("#nxs-header .nxs-logo a").css({ 171 top: 0, 172 position: "absolute" 173 }) 174 }) 175 176 $(headerInfo.logo.cssSelector) 177 .first() 178 .on("sticky-end", function() { 179 if ($(window).innerWidth() <= 1366) { 180 $("#nxs-header .nxs-logo img").css({ 181 "max-height": nxsMenuHeight - 10, 182 height: nxsMenuHeight - 10, 183 margin: "0 30px 30px 30px", 184 top: 5, 185 position: "absolute" 186 }) 187 $("#nxs-header .nxs-logo a").css({ 188 top: 0 189 }) 190 } else { 191 $("#nxs-header .nxs-logo img").css({ 192 "max-height": nxsDevLogoHeight - 10, 193 height: nxsDevLogoHeight - 10, 194 "margin-left": "auto", 195 "margin-right": "auto", 196 position: "absolute" 197 }) 198 $("#nxs-header .nxs-logo a").css({ 199 top: nxsDevLogoPos.top 200 }) 201 } 202 }) 203 // console.log('checkheaderobject is uitgevoerd!') 204 } 205 var nxsMenuHeight = $("#nxs-header .nxs-menu")
206 .closest(".nxs-row ") 207 .height() 208 var stickyNav = function() { 209 $(headerInfo.logo.cssSelector) 210 .first() 211 .sticky({ 212 zIndex: 2147483647, 213 topSpacing: 0 214 }) 215 216 $(headerInfo.menu.cssSelector) 217 .first() 218 .on("sticky-start", function() { 219 $("#nxs-content").css({ 220 "padding-top": 80 221 }) 222 }) 223 .on("sticky-end", function() { 224 $("#nxs-content").css({ 225 "padding-top": 30 226 }) 227 }) 228 .sticky({ 229 zIndex: 2147483646, 230 topSpacing: 0 231 }) 232 233 if ($(window).innerWidth() <= 1366) { 234 $(headerInfo.logo.cssSelector + ", " + headerInfo.logo.cssSelector) 235 .parent() 236 .css({ 237 position: "absolute", 238 width: "100%" 239 }) 240 $(headerInfo.menu.cssSelector + ", " + headerInfo.menu.cssSelector) 241 .parent() 242 .css({ 243 width: "100%" 244 }) 245 $("#nxs-header .nxs-logo") 246 .closest(".nxs-row ") 247 .addClass("nxs-logo-shrink") 248 .css({ 249 height: 0 250 }) 251 $("#nxs-header .nxs-logo a").css({ 252 top: 0 253 }) 254 $("#nxs-header .stop-absolute960.nxs-absolute img").css({ 255 margin: "0 30px 30px 30px", 256 height: nxsMenuHeight - 10, 257 "max-height": nxsMenuHeight - 10, 258 position: "absolute", 259 top: "5px" 260 }) 261 } 262 } 263 } 264 setTimeout(checkheaderobject, 300) 265 setTimeout(stickyNav, 320) 266})
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.