Setup
There are 2 ways to initialise the component.
Automatic
Add data-ecl-auto-init
attribute to component's markup
<nav
class="ecl-breadcrumb"
aria-label="You are here:"
data-ecl-breadcrumb
data-ecl-auto-init="Breadcrumb"
>
...
</nav>
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-breadcrumb
on the page:
var elt = document.querySelector('[data-ecl-breadcrumb]');
var breadcrumb = new ECL.Breadcrumb(elt);
breadcrumb.init();