on master help sign in
Adding disabled summary header opening
4f2cb08Matilde Park
static/scripts.js+17−1
@@ -367,6 +367,22 @@ window.addEventListener("scroll", event => {
367 }
367 }
368 });
368 });
369
369
370+ // this is honestly weird UX when selecting a link,
371+ // as every header flies open as you scroll.
372+ // for later discussion and experimentation --
373+ // may just need debouncing.
374+ // Also still working out the logic for closing other summary
375+ // headers as you scroll.
376+
377+// headers.forEach(summary => {
378+// let thisH2 = document.querySelector("h2#" + CSS.escape(summary.id));
379+// if (
380+// (thisH2.offsetTop <= fromTop) &&
381+// (thisH2.offsetTop + thisH2.offsetHeight > fromTop)
382+// ) {
383+// summary.parentElement.open = true;
384+// }
385+// })
370−});
386+//});
371
387
372}
388}
templates/page_indiced.html+1−1
@@ -36,7 +36,7 @@
36
36
37{% for h2 in toc %}
37{% for h2 in toc %}
38{% if h2.children %}
38{% if h2.children %}
39−<details class="page-indiced"><summary>{{ h2.title }}</summary>
39+<details class="page-indiced"><summary id={{h2.id}}>{{ h2.title }}</summary>
40 {% for h3 in h2.children %}
40 {% for h3 in h2.children %}
41 <li class="ml3 mv1"><a href="{{h3.permalink | safe}}">{{h3.title}}</a></li>
41 <li class="ml3 mv1"><a href="{{h3.permalink | safe}}">{{h3.title}}</a></li>
42 {% endfor %}
42 {% endfor %}