Closed SimonGemmel closed 2 years ago
+1 for this quick win. Very usefull when working in a "components driven application" where each component can be associated some perticular JS logic.
in html:
<div class="my-component" data-module="my-component>...</div>
In my-component.js:
export default {
// Here, $el represents the div.
init($el) {
const rellaxes = $el.querySelectorAll('.rellax');
this.rellax = new Rellax(rellaxes);
}
}
It is currently not possible to initialize with a list of elements. This change will make it possible to use a NodeList (querySelectorAll) or a HTMLCollection (getElementsByClassName / TagName / ...)