Wen Junhua 2023-11-26 16:13:04 +11:00 committed by GitHub
commit 778de4705d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 1 deletions

View File

@ -0,0 +1,6 @@
/*
Closes the hamburger menu when a link is clicked.
*/
function close_menu() {
document.getElementById('menu-controller').checked=false
}

View File

@ -17,7 +17,7 @@ enableImageLazyLoading = true
fingerprintAlgorithm = "sha256"
[header]
layout = "basic" # valid options: basic, hamburger, hybrid, custom
layout = "hamburger" # valid options: basic, hamburger, hybrid, custom
# logo = "img/logo.jpg"
# logoDark = "img/dark-logo.jpg"
showTitle = true

View File

@ -47,6 +47,10 @@
{{ $jsCode := resources.Get "js/code.js" }}
{{ $assets.Add "js" (slice $jsCode) }}
{{ end }}
{{ if eq .Site.Params.header.layout "hamburger" }}
{{ $jsMenu := resources.Get "js/menu.js" }}
{{ $assets.Add "js" (slice $jsMenu) }}
{{ end }}
{{ if eq (site.Language.LanguageDirection | default "ltr") "rtl" }}
{{ $jsRTL := resources.Get "js/rtl.js" }}
{{ $assets.Add "js" (slice $jsRTL) }}

View File

@ -93,6 +93,7 @@
<a
href="{{ .URL }}"
title="{{ .Title }}"
onclick="close_menu()"
{{ with .Params.target }}target="{{ . }}"{{ end }}
>{{ with .Params.icon }}
<span