🔀 Merge pull request #705 from Jh123x/fix/460/close-menu-on-site-click

fix: close menu button on click
pull/730/head
James Panther 2023-11-27 19:12:17 +11:00 committed by GitHub
commit e0aae4f096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 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

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

View File

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

View File

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

View File

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