This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
spdocker/themes/spd/source/js/toc.js
2018-03-07 15:58:54 +11:00

19 lines
545 B
JavaScript

var toc = document.getElementById('toc')
if (toc != null) {
window.addEventListener("scroll", scrollcatelogHandler);
var tocPosition = toc.offsetTop;
var height_header = $("#signature").height();
function scrollcatelogHandler(e) {
var event = e || window.event,
target = event.target || event.srcElement;
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
if (scrollTop > tocPosition -60) {
toc.classList.add("toc-fixed");
} else {
toc.classList.remove("toc-fixed");
}
}
}