Skip to main content

Callbacks

note

All Module callbacks are available in this class.

beforeSplit

Called before the text is split.

const text = new SplitText(
{
container,
},
{
onBeforeSplit: () => console.log('before split'),
},
);

or:

const destruct = text.on('beforeSplit', () => console.log('before split'));

// Cancel the callback
destruct();

split

Called after the text has been split.

const text = new SplitText(
{
container,
},
{
onSplit: () => console.log('split'),
},
);

or:

const destruct = text.on('split', () => console.log('split'));

// Cancel the callback
destruct();