Files
blog_os/blog/static/js/main.js
Philipp Oppermann 6a07fea2d7 Fix ToC resizing
The `#toc` id was renamed to `#toc-aside`.
2019-03-20 23:37:56 +01:00

27 lines
576 B
JavaScript

window.onload = function() {
var container = document.querySelector('#toc-aside');
if (container != null) {
resize_toc(container);
}
}
function resize_toc(container) {
var containerHeight = container.clientHeight;
var resize = function() {
if (containerHeight > document.documentElement.clientHeight - 100) {
container.classList.add('coarse');
} else {
container.classList.remove('coarse');
}
};
resize();
var resizeId;
window.onresize = function() {
clearTimeout(resizeId);
resizeId = setTimeout(resize, 300);
};
}