fix: scrollbar on thumbnails
This commit is contained in:
@@ -22,11 +22,21 @@ export const NavigationBar = ({
|
|||||||
currentPage,
|
currentPage,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Scroll à l'ouverture des contrôles et au changement de page
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (showControls) {
|
if (showControls) {
|
||||||
scrollToActiveThumbnail();
|
requestAnimationFrame(() => {
|
||||||
|
const thumbnail = document.getElementById(`thumbnail-${currentPage}`);
|
||||||
|
if (thumbnail) {
|
||||||
|
thumbnail.scrollIntoView({
|
||||||
|
behavior: showControls ? "instant" : "smooth",
|
||||||
|
block: "nearest",
|
||||||
|
inline: "center",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, [showControls, currentPage, scrollToActiveThumbnail]);
|
}, [showControls, currentPage]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user