Add smooth scrolling to YouTube cards when circle is clicked

This commit is contained in:
Chigozirim Igweamaka 2024-06-30 14:16:28 +01:00
parent 46e2a87e76
commit 7c784d6384

View file

@ -72,7 +72,11 @@ const CarouselSliders = (props) => {
: `${styles.Link} ${styles.ActiveLink}`
}
href={`#slide-${match.YouTubeID}`}
onClick={() => {
onClick={(e) => {
e.preventDefault();
document
.getElementById(`slide-${match.YouTubeID}`)
.scrollIntoView({ behavior: "smooth" });
setActiveVideoID(match.YouTubeID);
}}
></a>