fix(scroll-to-top): resolve overlap with buy me a coffee button

This commit is contained in:
ZhenShuo Leo
2025-07-25 03:52:54 +08:00
parent 019388def8
commit b777d4e59e
4 changed files with 53 additions and 24 deletions

View File

@@ -69,6 +69,10 @@
type="text/javascript"
src="{{ $jsAppearance.RelPermalink }}"
integrity="{{ $jsAppearance.Data.Integrity }}"></script>
{{ if site.Params.footer.showScrollToTop | default true }}
{{ $jsToTop := resources.Get "js/scroll-to-top.js" }}
{{ $assets.Add "js" (slice $jsToTop) }}
{{ end }}
{{ if .Site.Params.enableA11y | default false }}
{{ $jsA11y := resources.Get "js/a11y.js" }}
{{ $jsA11y = $jsA11y | resources.Minify | resources.Fingerprint (site.Params.fingerprintAlgorithm | default "sha512") }}
@@ -83,6 +87,10 @@
src="{{ $jsZenMode.RelPermalink }}"
integrity="{{ $jsZenMode.Data.Integrity }}"></script>
{{ end }}
{{ if site.Params.footer.showScrollToTop | default true }}
{{ $jsToTop := resources.Get "js/scroll-to-top.js" }}
{{ $assets.Add "js" (slice $jsToTop) }}
{{ end }}
{{ if .Site.Params.enableSearch | default false }}
{{ $jsFuse := resources.Get "lib/fuse/fuse.min.js" }}
{{ $jsSearch := resources.Get "js/search.js" }}

View File

@@ -1,7 +1,11 @@
<div id="top-scroller" class="pointer-events-none absolute top-[110vh] bottom-0 w-12 ltr:right-0 rtl:left-0 z-10">
{{ $coffeeIsRight := and site.Params.buymeacoffee.globalWidget (eq site.Params.buymeacoffee.globalWidgetPosition "Right") }}
{{ $toTopYOffset := cond $coffeeIsRight "bottom-24" "bottom-6" }}
<div
id="scroll-to-top"
class="fixed {{ $toTopYOffset }} end-6 z-50 transform translate-y-4 opacity-0 duration-200">
<a
href="#the-top"
class="pointer-events-auto sticky top-[calc(100vh-5.5rem)] flex h-12 w-12 mb-16 items-center justify-center rounded-full bg-neutral/50 text-xl text-neutral-700 hover:text-primary-600 dark:bg-neutral-800/50 dark:text-neutral dark:hover:text-primary-400"
class="pointer-events-auto flex h-12 w-12 items-center justify-center rounded-full bg-neutral/50 text-xl text-neutral-700 hover:text-primary-600 dark:bg-neutral-800/50 dark:text-neutral dark:hover:text-primary-400"
aria-label="{{ i18n "nav.scroll_to_top_title" }}"
title="{{ i18n "nav.scroll_to_top_title" }}">
&uarr;