Components

Timeline

Try it yourself on the playground

Playground

JS behaviour

Auto initialisation

In order to automatically initalise the JS behaviour, add data-ecl-auto-init="Timeline2" to your component's markup:

<ol
  class="ecl-timeline2"
  data-ecl-timeline="true"
  data-ecl-auto-init="Timeline2"
>
  ...
</ol>

Don't forget to call ECL.autoInit() when your page is ready!

Manual initialisation

When the document is ready, query the element. For example, you can use document.querySelector('[data-ecl-timeline2]') if you only have 1 timeline in the page.

Then, instantiate the Timeline2 component and call init():

var elt = document.querySelector('[data-ecl-timeline2]');
var timeline2 = new ECL.Timeline2(elt);
timeline2.init();