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);
const articles = [
{
id: "apollo-program",
title: "Apollo program",
from: { year: 1961, month: 5, day: 25 },
to: { year: 1972, month: 12, day: 19 }
},
{
id: "iss-operations",
title: "ISS operations",
from: { year: 1998, month: 11, day: 20 },
isToPresent: true
}
];