Configuration
Learn how to configure your Tolstoy widget to perform different functions on your site.
Settings
We support the following additional configurations:
alwaysShow: In case a user closed the widget and you want to keep showing it to him.
alwaysShow: true
loadHidden: load the widget without showing it.
loadHidden: true
stopPreviewLoop: stop the preview window from endlessly looping.
stopPreviewLoop: true
noCloseOption: no option to close the widget.
noCloseOption: true
Add the following code to the page in oder to set the settings:
window.tolstoySettings = {
alwaysShow: true,
loadHidden: true,
stopPreviewLoop: true,
noCloseOption: true,
};
start()
Start the widget, open it expanded and plays immediately
window.tolstoyWidget.start();
startPart(partNumber)
Start the widget at a specific part number, open it expanded and plays immediately. If the widget is already open it will start to play the given part.
window.tolstoyWidget.startPart(partNumber);
closePlayer()
Close the player if it was opened, does not hide the widget bubble
window.tolstoyWidget.closePlayer();
show()
Show the widget bubble if it was loaded hidden or closed
window.tolstoyWidget.show();
hide()
Hide the widget bubble from screen
window.tolstoyWidget.hide();
recreate(tolstoyWidgetId, settings)
Load a new widget with a different Tolstoy Id, remember to replace the {{TOLSTOY_ID}}
window.tolstoyWidget.recreate('{{TOLSTOY_ID}}');
on(eventType, callback)
Trigger a callback on a specific event
Params:
eventType
supported events:
onWidgetOpen - triggers when the widget is opened
onWidgetClose - triggers when the widget is closed
onWidgetReady - triggers when the widget is ready
callback
A function to trigger
window.tolstoyWidget.on('onWidgetOpen', () => { console.log('Widget Opened') });
Last updated
Was this helpful?