Page indicator in navigation bar

This commit is contained in:
Nuno Coração
2023-01-14 23:50:34 +00:00
parent 3a81b0a741
commit a194975889
10 changed files with 88 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
<div style="padding-left:0;padding-right:0;padding-top:2px;padding-bottom:3px"
class="flex items-center justify-between px-4 py-6 sm:px-6 md:justify-start space-x-3">
class="main-menu flex items-center justify-between px-4 py-6 sm:px-6 md:justify-start space-x-3">
{{ if .Site.Params.Logo }}
{{ $logo := resources.Get .Site.Params.Logo }}
{{ if $logo }}
@@ -144,7 +144,8 @@
</div>
{{ if .Site.Menus.subnavigation }}
<div class="flex pb-3 flex-col items-end justify-between md:justify-start space-x-3" {{ if .Site.Params.Logo }} style="margin-top:-15px" {{ end }}>
<div class="main-menu flex pb-3 flex-col items-end justify-between md:justify-start space-x-3" {{ if .Site.Params.Logo
}} style="margin-top:-15px" {{ end }}>
<div class="hidden md:flex items-center space-x-5">
{{ range .Site.Menus.subnavigation }}
<a href="{{ .URL }}" {{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" ) }}
@@ -161,4 +162,17 @@
{{ end }}
</div>
</div>
{{ end }}
{{ if .Site.Params.highlightCurrentMenuArea }}
<script>
(function () {
var $mainmenu = $('.main-menu');
var path = window.location.pathname;
$mainmenu.find('a[href="' + path + '"]').each(function (i, e) {
console.log($(e).children('a'))
$(e).children('p').addClass('active');
});
})();
</script>
{{ end }}