From a740ac9bf8086b9e056451102459f21f1585622f Mon Sep 17 00:00:00 2001 From: Marcell Mars Date: Mon, 7 Dec 2020 15:42:27 +0100 Subject: [PATCH] anchors top scroll offset --- .../Drawwell/SandpointsTheme/assets/js/sandpoints.js | 8 ++++++++ .../layouts/_default/_markup/render-link.html | 2 +- _vendor/modules.txt | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/assets/js/sandpoints.js b/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/assets/js/sandpoints.js index 9a72c0f..3bde91e 100644 --- a/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/assets/js/sandpoints.js +++ b/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/assets/js/sandpoints.js @@ -70,6 +70,14 @@ window.addEventListener('DOMContentLoaded', (e) => { window.scrollBy({top: document.querySelector('.header').clientHeight * -1.25, behavior: 'smooth'})}, 50); }) }) + + document.querySelectorAll('.anchorz').forEach(i => { + i.addEventListener('click', e => { + setTimeout(() => { + window.scrollBy({ top: document.querySelector('.header').clientHeight * -1.25, behavior: 'smooth' }) + }, 50); + }) + }) }) toggleAllLinks = function () { diff --git a/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/layouts/_default/_markup/render-link.html b/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/layouts/_default/_markup/render-link.html index e886866..ed0b063 100644 --- a/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/layouts/_default/_markup/render-link.html +++ b/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/layouts/_default/_markup/render-link.html @@ -1 +1 @@ -{{- .Page.Scratch.Add "urls" (slice .Destination) -}}{{- $t := .Text -}}{{- $sup := "" -}}{{- if and (strings.HasPrefix .Destination "{") (.Destination | strings.Count "}") -}}{{- range first 1 (split .Destination "}") -}}{{- range $frmt := (split (substr . 1) ",") -}}{{- if eq $frmt "sc" -}}{{- $t -}}{{- end -}}{{- end -}}{{- end -}}{{- else }}{{- if strings.HasPrefix .Destination "http" -}}{{- $sup = "www" -}}{{- end -}}{{- if strings.HasPrefix .Destination "#" -}}{{- $sup = "§" -}}{{- end -}}{{- $sup -}}⁄{{ .Text | safeHTML }}{{- end -}} \ No newline at end of file +{{- .Page.Scratch.Add "urls" (slice .Destination) -}}{{- $t := .Text -}}{{- $sup := "" -}}{{- if and (strings.HasPrefix .Destination "{") (.Destination | strings.Count "}") -}}{{- range first 1 (split .Destination "}") -}}{{- range $frmt := (split (substr . 1) ",") -}}{{- if eq $frmt "sc" -}}{{- $t -}}{{- end -}}{{- end -}}{{- end -}}{{- else }}{{- if strings.HasPrefix .Destination "http" -}}{{- $sup = "www" -}}{{- end -}}{{- if strings.HasPrefix .Destination "#" -}}{{- $sup = "§" -}}{{- end -}}{{- $sup -}}⁄{{ .Text | safeHTML }}{{- end -}} \ No newline at end of file diff --git a/_vendor/modules.txt b/_vendor/modules.txt index 6fbae49..23adbca 100644 --- a/_vendor/modules.txt +++ b/_vendor/modules.txt @@ -1 +1 @@ -# git.sandpoints.org/Drawwell/SandpointsTheme v0.0.0-20201207124734-b3fede2839c9 +# git.sandpoints.org/Drawwell/SandpointsTheme v0.0.0-20201207142206-ba2a130517be