diff --git a/README.md b/README.md index 631449de3..f6354ca74 100644 --- a/README.md +++ b/README.md @@ -1704,7 +1704,7 @@ embla.destroy() const embla = EmblaCarousel(emblaNode, options) const onInitCallback = () => { - console.log('The carousel has just been initialized.') + console.log('The carousel is ready to rock.') } embla.on('init', onInitCallback) @@ -1793,11 +1793,17 @@ embla.on('scroll', () => {
- Under construction... + Fire your callback when the carousel mounts.
- Under construction... + This event fires the given callback when the carousel has initialised and its + + API + is ready to use. Note that the init event only fires once upon the first initialisation and won't trigger when invoking + + changeOptions + or similar.

@@ -1806,7 +1812,7 @@ embla.on('scroll', () => {   - CodeSandbox + CodeSandbox (upcoming)

@@ -1816,6 +1822,12 @@ embla.on('scroll', () => { ```javascript const embla = EmblaCarousel(emblaNode, options) + +const onInitCallback = () => { + console.log('The carousel is ready to rock.') +}) + +embla.on('init', onInitCallback) ```