API
BreadcrumbCore
Parameters
elementHTMLElement DOM element for component instantiation and scopeoptionsObject (optional, default{})options.ellipsisButtonSelectorString (optional, default'[data-ecl-breadcrumb-core-ellipsis-button]')options.ellipsisSelectorString (optional, default'[data-ecl-breadcrumb-core-ellipsis]')options.segmentSelectorString (optional, default'[data-ecl-breadcrumb-core-item]')options.expandableItemsSelectorString (optional, default'[data-ecl-breadcrumb-core-item="expandable"]')options.staticItemsSelectorString (optional, default'[data-ecl-breadcrumb-core-item="static"]')options.onPartialExpandFunction (optional, defaultnull)options.onFullExpandFunction (optional, defaultnull)options.attachClickListenerBoolean (optional, defaulttrue)
init
Initialise component.
destroy
Destroy component.
handleClickOnEllipsis
Invoke event listener attached on the elipsis. Traslates to a full expand.
check
Apply partial or full expand.
hideEllipsis
Removes the elipsis element and its event listeners.
showAllItems
Show all expandable elements.
handlePartialExpand
Parameters
visibilityMapObject
handleFullExpand
Display all elements.
computeVisibilityMap
Measure/evaluate which elements can be displayed and toggle those who don't fit.
autoInit
Parameters
rootHTMLElement DOM element for component instantiation and scope$1Object (optional, default{})$1.BREADCRUMB_CORE(optional, default{})
Returns Breadcrumb An instance of Breadcrumb.
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-core
data-ecl-auto-init="BreadcrumbCore"
>
...
</nav>
Possible values:
BreadcrumbCoreBreadcrumbStandardisedBreadcrumbHarmonised
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-core on the page:
var elt = document.querySelector('[data-ecl-breadcrumb-core]');
var breadcrumb = new ECL.BreadcrumbCore(elt);
breadcrumb.init();