in _static/js/theme.js [648:692]
handleRightMenu: function() {
var rightMenuWrapper = document.getElementById("pytorch-content-right");
var rightMenu = document.getElementById("pytorch-right-menu");
var rightMenuList = rightMenu.getElementsByTagName("ul")[0];
var article = document.getElementById("pytorch-article");
var articleHeight = article.offsetHeight;
var articleBottom = utilities.offset(article).top + articleHeight;
var mainHeaderHeight = document.getElementById('header-holder').offsetHeight;
if (utilities.scrollTop() < mainHeaderHeight) {
rightMenuWrapper.style.height = "100%";
rightMenu.style.top = 0;
rightMenu.classList.remove("scrolling-fixed");
rightMenu.classList.remove("scrolling-absolute");
} else {
if (rightMenu.classList.contains("scrolling-fixed")) {
var rightMenuBottom =
utilities.offset(rightMenuList).top + rightMenuList.offsetHeight;
if (rightMenuBottom >= articleBottom) {
rightMenuWrapper.style.height = articleHeight + mainHeaderHeight + "px";
rightMenu.style.top = utilities.scrollTop() - mainHeaderHeight + "px";
rightMenu.classList.add("scrolling-absolute");
rightMenu.classList.remove("scrolling-fixed");
}
} else {
rightMenuWrapper.style.height = articleHeight + mainHeaderHeight + "px";
rightMenu.style.top =
articleBottom - mainHeaderHeight - rightMenuList.offsetHeight + "px";
rightMenu.classList.add("scrolling-absolute");
}
if (utilities.scrollTop() < articleBottom - rightMenuList.offsetHeight) {
rightMenuWrapper.style.height = "100%";
rightMenu.style.top = "";
rightMenu.classList.remove("scrolling-absolute");
rightMenu.classList.add("scrolling-fixed");
}
}
var rightMenuSideScroll = document.getElementById("pytorch-side-scroll-right");
var sideScrollFromWindowTop = rightMenuSideScroll.getBoundingClientRect().top;
rightMenuSideScroll.style.height = utilities.windowHeight() - sideScrollFromWindowTop + "px";
}