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

19 lines
545 B
JavaScript
Raw Normal View History

2018-03-07 04:58:54 +00:00
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");
}
}
}