Skip to content

Instantly share code, notes, and snippets.

@Saoming
Created August 3, 2023 16:13
Show Gist options
  • Save Saoming/28913e708f0a1772e90a03c378769629 to your computer and use it in GitHub Desktop.
Save Saoming/28913e708f0a1772e90a03c378769629 to your computer and use it in GitHub Desktop.
Splide JS
class ExampleSliders {
splideSettings() {
const elms = document.getElementsByClassName('splide');
for (let i = 0; i < elms.length; i++) {
// eslint-disable-next-line no-undef
new Splide(elms[i]).mount();
}
}
fireWhenReady(func) {
// call method when DOM is loaded
return document.addEventListener('DOMContentLoaded', func);
}
init() {
this.fireWhenReady(this.splideSettings);
}
}
export default ExampleSliders;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment