Components

Banner

Setup

There are 2 ways to initialise the component.

Automatic

Add data-ecl-auto-init="Banner" attribute to component's markup:

<section class="ecl-banner" data-ecl-banner data-ecl-auto-init="Banner">
  ...
</section>

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-banner on the page:

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

Retrieve an existing instance

var elt = document.querySelector('[data-ecl-banner]');
var instance = ECL.components.get(elt);

API