1$(document).ready(function () { 2 3 var sidebarInner = $('.sidebar-inner'); 4 5 initAffix(); 6 resizeListener(); 7 8 function initAffix () { 9 var headerOffset = getHeaderOffset(), 10 footerOffset = getFooterOffset(), 11 sidebarHeight = $('#sidebar').height() + NexT.utils.getSidebarb2tHeight(), 12 contentHeight = $('#content').height(); 13 14 // Not affix if sidebar taller then content (to prevent bottom jumping). 15 if (headerOffset + sidebarHeight < contentHeight) { 16 sidebarInner.affix({ 17 offset: { 18 top: headerOffset - CONFIG.sidebar.offset, 19 bottom: footerOffset 20 } 21 }); 22 } 23 24 setSidebarMarginTop(headerOffset).css({ 'margin-left': 'initial' }); 25 } 26 27 function resizeListener () { 28 var mql = window.matchMedia('(min-width: 991px)'); 29 mql.addListener(function(e){ 30 if(e.matches){ 31 recalculateAffixPosition(); 32 } 33 }); 34 } 35 36 function getHeaderOffset () { 37 return $('.header-inner').height() + CONFIG.sidebar.offset; 38 } 39 40 function getFooterOffset () { 41 var footerInner = $('.footer-inner'), 42 footerMargin = footerInner.outerHeight(true) - footerInner.outerHeight(), 43 footerOffset = footerInner.outerHeight(true) + footerMargin; 44 return footerOffset; 45 } 46 47 function setSidebarMarginTop (headerOffset) { 48 return $('#sidebar').css({ 'margin-top': headerOffset }); 49 } 50 51 function recalculateAffixPosition () { 52 $(window).off('.affix'); 53 sidebarInner.removeData('bs.affix').removeClass('affix affix-top affix-bottom'); 54 initAffix(); 55 } 56 57});
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.