Files
blog_os/blog/static/js/main.js
Philipp Oppermann dae2edfbf5 Let gutenberg generate the table of contents
Remove the javascript toc code.
2017-10-05 11:37:23 +02:00

27 lines
570 B
JavaScript

window.onload = function() {
var container = document.querySelector('#toc');
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);
};
}