feat(toc): auto-scroll del sidebar al elemento activo
Cuando el ScrollSpy detecta un nuevo heading activo, el TOC sidebar ahora hace scroll automático para mostrar el elemento activo usando scrollIntoView con behavior: smooth y block: nearest. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -549,6 +549,12 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
if (sectionMap[topMostSection]) {
|
if (sectionMap[topMostSection]) {
|
||||||
sectionMap[topMostSection].classList.add('active');
|
sectionMap[topMostSection].classList.add('active');
|
||||||
currentActive = topMostSection;
|
currentActive = topMostSection;
|
||||||
|
|
||||||
|
// Auto-scroll del TOC para mostrar el elemento activo
|
||||||
|
sectionMap[topMostSection].scrollIntoView({
|
||||||
|
behavior: 'smooth',
|
||||||
|
block: 'nearest'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user