Keep a long-running article card visible while its date range still crosses the viewport.
When an article starts before the visible range but ends within or after it, collectOngoing pins its card to the viewport's left edge. This works for periods with a fixed to date and periods marked isToPresent.
const timeline = new Histropedia.Timeline(container, {
article: {
collectOngoing: true
}
});
timeline.load(articles);
// Change the behavior later if needed.
timeline.setOption("article.collectOngoing", false);
// Excerpt from the demo dataset: one fixed-end period and one
// marked isToPresent. The demo loads eight articles like these.
const articles = [
{
id: "ongoing-apollo",
title: "Apollo program",
from: { year: 1961, month: 5, day: 25 },
to: { year: 1972, month: 12, day: 19 }
},
{
id: "ongoing-iss",
title: "ISS operations",
from: { year: 1998, month: 11, day: 20 },
isToPresent: true
}
];