Utilizing ReactJs, I am developing a horizontal timeline that showcases dates.
For instance, there is a list of 100 elements, each containing a date and text content.
The dates are displayed horizontally using flex-direction="row"
and overflowX: "auto"
, while the content with date + text content is displayed vertically with styled formatting.
https://i.sstatic.net/JNkuR.gif
When clicking on a date in the "horizontal date TimeLine," the page automatically scrolls to the corresponding content using an anchor link (not shown in the provided gif). As the page is scrolled over the contents, the related dates in the "horizontal date TimeLine" turn red to indicate the current position.
The issue lies in wanting to center or scroll to the "current date" (e.g. '02/07') within the "horizontal date TimeLine." Currently, manual horizontal scrolling is required.
I'm unsure how to achieve horizontal scrolling inside the overflowed div without utilizing an anchor. Any tips on accomplishing this by referencing element's index or id would be greatly appreciated. Thank you!