I am attempting to create a horizontal timeline similar to this example: https://codepen.io/ritz078/pen/LGRWjE
The issue I am facing is that I do not have specific dates (DD/MM/YYYY) but only ranges such as 1998-2002 or single years like 2009. This has caused a problem that I am struggling to resolve, resulting in the display issue shown here:
https://i.sstatic.net/4C7xN.png
My objectives are as follows:
- Establish a fixed distance between timeline elements
- Create functionality that works solely with years
- For devices less than 768px wide, ensure only one element is displayed and centered
I have managed to find a solution for objective 3., however, I am facing challenges with the other requirements:
if ($(window).width() < 768 {
eventsMinDistance = $('.cd-horizontal-timeline .events-wrapper').width(/2;)
}
(timelines.length > 0) && initTimeline(timelines);
$(window).resize(function(){
if ($(window).width() < 768 {
eventsMinDistance = $('.cd-horizontal-timeline .events-wrapper').width(/2;)
} else{
eventsMinDistance = 155;
}
}
If anyone knows how to address these issues, I would greatly appreciate your assistance. I have been struggling for hours without success. Thank you for your help!