Setup
There are 2 ways to initialise the component.
Automatic
Add data-ecl-auto-init="Tabs"
attribute to component's markup:
<div class="ecl-tabs" data-ecl-tabs data-ecl-auto-init="Tabs">...</div>
Use the ECL
library's autoInit()
(ECL.autoInit()
) when your page is ready or other custom event you want to hook onto.
Manual
Get target element, create an instance and invoke init()
.
Given you have 1 element with an attribute data-ecl-tabs
on the page:
var elt = document.querySelector('[data-ecl-tabs]');
var tabs = new ECL.Tabs(elt);
tabs.init();