diff --git a/src/components/widgets/FootnoteScroll.astro b/src/components/widgets/FootnoteScroll.astro index 7afba67..baba037 100644 --- a/src/components/widgets/FootnoteScroll.astro +++ b/src/components/widgets/FootnoteScroll.astro @@ -19,6 +19,17 @@ window.scrollTo({ top: targetPosition }) + + // Highlight effect + const highlightTarget = target.closest('cite') || target.closest('sup') || target + highlightTarget.classList.add('footnote-highlight') + highlightTarget.addEventListener( + 'animationend', + () => { + highlightTarget.classList.remove('footnote-highlight') + }, + { once: true } + ) }) }) } diff --git a/src/styles/post.css b/src/styles/post.css index ed245b7..6d8db0b 100644 --- a/src/styles/post.css +++ b/src/styles/post.css @@ -450,7 +450,7 @@ opacity: 0.875; text-decoration: none; transition: color 0.2s ease-out; - padding-right: 0.5em; + padding-right: 0.125em; } .prose [data-footnote-ref]:hover, @@ -458,6 +458,23 @@ color: var(--text-primary); } +/* Footnote highlight animation */ +.prose .footnotes li.footnote-highlight, +.prose sup.footnote-highlight, +.prose cite.footnote-highlight { + animation: footnote-highlight 1.35s ease-out; +} + +@keyframes footnote-highlight { + 0%, + 87% { + background-color: var(--selection); + } + 100% { + background-color: transparent; + } +} + /* Code blocks */ .prose pre { background-color: var(--astro-code-background);