From 7c784d638485cf64e99b33f3f6a43198b0ce710d Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Sun, 30 Jun 2024 14:16:28 +0100 Subject: [PATCH] Add smooth scrolling to YouTube cards when circle is clicked --- client/src/components/CarouselSliders.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/components/CarouselSliders.js b/client/src/components/CarouselSliders.js index 2f8686e..3a18c9c 100644 --- a/client/src/components/CarouselSliders.js +++ b/client/src/components/CarouselSliders.js @@ -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); }} >