Add toggle toc button

This commit is contained in:
Track3 2018-12-28 22:52:23 +08:00
parent 2b5999616d
commit 98c3c64499
3 changed files with 29 additions and 5 deletions

View file

@ -65,12 +65,18 @@ const showContent = () => {
document.getElementById('bg-img').classList.remove('show-bg-img');
}
// Toggle TOC
//
const toggleToc = () => {
document.getElementById('toc').classList.toggle('show-toc');
}
if (haveHeader == true) {
document.getElementById('menu-btn').addEventListener('click', mobileMenuToggle);
window.addEventListener('scroll', throttle(() => {
autoHideHeader();
if (mobileMenuVisible == true) {
mobileMenuToggle();
}