var scroll = new SmoothScroll('a[href*="#"]');
window.onscroll = function() {updateOnScroll()};
function updateOnScroll() { updateProgressBar(); adjustNavigation();
updateSectionMenuPosition(); updateSectionMenuEmphasis();
}
// This variable is used to keep track of changes in scroll position var prevScrollpos = window.pageYOffset;
var navUp = false;
// Hides the navigation bar when user scrolls down and shows it when user scrolls up function adjustNavigation() { var currentScrollPos = window.pageYOffset;
fixedContent = document.getElementById("fixed-content"); navBar = document.getElementById("navbar"); banner = document.getElementById("banner"); navHeight = navBar.offsetHeight; topMenuHeight = document.getElementById("top_menu_14").offsetHeight;
// Only hide the navigation bar when the user is below the fixed content menu if ((prevScrollpos > currentScrollPos || currentScrollPos < fixedContent.offsetHeight) && navUp) { fixedContent.style.top = (topMenuHeight) + "px"; navUp = false; } else if (!(prevScrollpos > currentScrollPos || currentScrollPos < fixedContent.offsetHeight) && !navUp) { fixedContent.style.top = (topMenuHeight-navHeight) + "px"; navUp = true; }
prevScrollpos = currentScrollPos; adjustMarkers();
}
var bigScreen = false;
var windowWidth = window.matchMedia("(min-width: 769px");
windowWidth.addListener(identifyBigScreen);
function identifyBigScreen(windowWidth) { if (windowWidth.matches && !bigScreen) { bigScreen = true; updateOnScroll(); adjustBody(); } else if (!windowWidth.matches && bigScreen) { bigScreen = false; adjustBody(); } }
function adjustMarkers() {
fixedContent = document.getElementById("fixed-content"); navBar = document.getElementById("navbar"); banner = document.getElementById("banner"); navHeight = navBar.offsetHeight;
markers = document.getElementsByClassName("section-marker"); for(var markerIndex = 0; markerIndex < markers.length; ++markerIndex) { markers[markerIndex].style.top = (-(fixedContent.offsetHeight + 35)) + "px"; } }