mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 13:24:05 -06:00
Merge pull request #5 from y1450/menu-ux
menu ux : handling active page
This commit is contained in:
commit
bdce6332fe
@ -129,6 +129,17 @@
|
||||
true
|
||||
);
|
||||
|
||||
// open all parents items of selected page
|
||||
document.querySelectorAll('a.active').forEach(function(child){
|
||||
while(!child.classList.contains("tree")){
|
||||
if (child.tagName=="DETAILS"){
|
||||
child.open=true
|
||||
}
|
||||
child=child.parentElement;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
{{end}}
|
||||
|
||||
{{if $.Site.Data.config.enableLinkPreview}}
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
{{ range (where .Section.Pages "Params.bookhidden" "ne" true) }}
|
||||
{{ if .IsSection }}
|
||||
<details open>
|
||||
<details>
|
||||
<summary>
|
||||
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
|
||||
</summary>
|
||||
@ -35,16 +35,7 @@
|
||||
{{ define "book-page-link" }}{{/* (dict "Page" .Page "CurrentPage" .CurrentPage) */}}
|
||||
{{ $current := eq .CurrentPage .Page }}
|
||||
{{ $ancestor := .Page.IsAncestor .CurrentPage }}
|
||||
|
||||
{{ if .Page.Params.bookCollapseSection }}
|
||||
<input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} />
|
||||
<label for="section-{{ md5 .Page }}" class="flex justify-between">
|
||||
<a {{ if .Page.Content }}href="{{ .Page.Permalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}">
|
||||
{{- partial "docs/title" .Page -}}
|
||||
</a>
|
||||
</label>
|
||||
|
||||
{{ else if .Page.Content }}
|
||||
{{if .Page.Content }}
|
||||
|
||||
<a href="{{ .Page.Permalink }}" class="{{ if $current }}active{{ end }}">
|
||||
{{- partial "title" .Page -}}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user