summaryrefslogtreecommitdiff
path: root/_includes
diff options
context:
space:
mode:
authorjeffreytse <jeffreytse.mail@gmail.com>2020-08-31 19:46:13 +0800
committerjeffreytse <jeffreytse.mail@gmail.com>2020-09-01 10:55:01 +0800
commit33e006dbcae7451a18bcc64a4372dcde495acb28 (patch)
tree80e60356eb2613e637f9faba9fa80f0449842182 /_includes
parent663b1e567f88cbed3e923337470c9522caf9f0c6 (diff)
feat: auto collapsed menu by heading amount
Diffstat (limited to '_includes')
-rw-r--r--_includes/sidebar/article-menu.html7
1 files changed, 6 insertions, 1 deletions
diff --git a/_includes/sidebar/article-menu.html b/_includes/sidebar/article-menu.html
index 215e808..2e273de 100644
--- a/_includes/sidebar/article-menu.html
+++ b/_includes/sidebar/article-menu.html
@@ -36,8 +36,13 @@
// The header element
var header = document.querySelector('header.site-header');
- function doMenuCollapse(index) {
+ function doMenuCollapse(index, over_items=20) {
var items = menuContent.firstChild.children;
+
+ if (items.length < over_items) {
+ return;
+ }
+
var activeItem = items[index];
var beginItem = activeItem
var endItem = activeItem