mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
✨ Page indicator in navigation bar
This commit is contained in:
@@ -49,9 +49,6 @@
|
||||
"sha512" }}
|
||||
<link type="text/css" rel="stylesheet" href="{{ $bundleCSS.RelPermalink }}"
|
||||
integrity="{{ $bundleCSS.Data.Integrity }}" />
|
||||
{{ $jsMain := resources.Get "js/main.js" }}
|
||||
{{ $jsMain = $jsMain | resources.Minify | resources.Fingerprint "sha512" }}
|
||||
<script type="text/javascript" src="{{ $jsMain.RelPermalink }}" integrity="{{ $jsMain.Data.Integrity }}"></script>
|
||||
{{ $jsAppearance := resources.Get "js/appearance.js" }}
|
||||
{{ $jsAppearance = $jsAppearance | resources.Minify | resources.Fingerprint "sha512" }}
|
||||
<script type="text/javascript" src="{{ $jsAppearance.RelPermalink }}"
|
||||
|
||||
@@ -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 }}
|
||||
@@ -18,8 +18,9 @@
|
||||
{{ .TableOfContents | emojify }}
|
||||
</div>
|
||||
</details>
|
||||
<script>
|
||||
|
||||
{{ if .Site.Params.smartTOC }}
|
||||
<script>
|
||||
(function () {
|
||||
var $toc = $('#TableOfContents');
|
||||
if ($toc.length > 0) {
|
||||
@@ -31,27 +32,34 @@
|
||||
var id = "";
|
||||
h.each(function (i, e) {
|
||||
e = $(e);
|
||||
if (e.offset().top - $(window).height()/2 <= currentScroll) {
|
||||
if (e.offset().top - $(window).height()/3 <= currentScroll) {
|
||||
id = e.attr('id');
|
||||
}
|
||||
});
|
||||
var active = $toc.find('a.active');
|
||||
if (active.length == 1 && active.eq(0).attr('href') == '#' + id) return true;
|
||||
|
||||
active.each(function (i, e) {
|
||||
$(e).removeClass('active').siblings('ul').hide();
|
||||
{{ if .Site.Params.smartTOCHideUnfocusedChildren }}
|
||||
$(e).removeClass('active').siblings('ul').hide();
|
||||
{{ else }}
|
||||
$(e).removeClass('active');
|
||||
{{ end }}
|
||||
});
|
||||
$toc.find('a[href="#' + id + '"]').addClass('active')
|
||||
$toc.find('a[href="#' + id + '"]').parentsUntil('#TableOfContents').each(function (i, e) {
|
||||
console.log($(e).children('a'))
|
||||
$(e).children('a').addClass('active').parents('ul').show();
|
||||
$(e).children('a').parents('ul').show();
|
||||
});
|
||||
}
|
||||
|
||||
$window.on('scroll', onScroll);
|
||||
$(document).ready(function () {
|
||||
$toc.find('a').parent('li').find('ul').hide();
|
||||
{{ if .Site.Params.smartTOCHideUnfocusedChildren }}
|
||||
$toc.find('a').parent('li').find('ul').hide();
|
||||
{{ end }}
|
||||
onScroll();
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
</script>
|
||||
</script>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user