Compare commits

..

No commits in common. "cd9959dfc6c9d2350e14944beea47a8aa97db5a5" and "4e66d244eee15f24895395ed67bcb44ad1d0d1a1" have entirely different histories.

4 changed files with 21 additions and 6 deletions

View File

@ -4,7 +4,6 @@
&:hover {
@apply underline underline-offset-8;
text-decoration-thickness: 1px;
@apply decoration-neutral-400;
&:after {
transform: translate(0px, -2px) scale(1.1);

View File

@ -34,7 +34,7 @@
.sommaire-index a:hover,
.footnotes-index a:hover {
@apply text-carhop-green-800 underline-offset-8 underline decoration-neutral-400;
@apply text-carhop-green-800 underline-offset-8 underline;
text-decoration-thickness: 1px;
}
}

View File

@ -69,6 +69,12 @@ function observeSommaireLinks(): void {
}
}
function handleSmoothScrollToTitle(targetId: string): void {
const targetElement = document.querySelector(`#${targetId}`);
if (!targetElement) return;
targetElement.scrollIntoView({ behavior: 'smooth' });
}
function toggleActiveChapterLinkInIndexPanel(targetId: string): void {
const sommaireLinks: NodeListOf<Element> = document.querySelectorAll('.sommaire-index li a');

View File

@ -1,6 +1,16 @@
export function handleSmoothScrollToTitle(targetId: string): void {
const targetElement = document.querySelector(`#${targetId}`);
if (!targetElement) return;
export function handleSmoothScrollToTitle(): void {
const sommaireTitles: NodeListOf<Element> = document.querySelectorAll('.sommaire-index li a');
for (const title of sommaireTitles) {
title.addEventListener('click', (e) => {
e.preventDefault();
targetElement.scrollIntoView({ behavior: 'smooth' });
const target = title.getAttribute('href');
if (!target) return;
const targetElement = document.querySelector(target);
if (!targetElement) return;
targetElement.scrollIntoView({ behavior: 'smooth' });
});
}
}