Opening a Tolstoy widget with a click of a button on your website can be super helpful if you prefer not to overpopulate your page. If you are wondering how you can make a Tolstoy widget appear on the same page by just clicking a button, no problem! We got you. We have a way to do that, and here's an easy tutorial to follow:
1. You can initiate a Tolstoy widget by adding a script to the button you want to click:
window.tolstoyWidget.recreate('<TOLSTOY_PUBLISH_ID>');
2. To get the publish ID, go to the preview of Tolstoy by clicking on the "preview" button in the project or by navigating to settings, Tolstoy ID.
3. Once you're at your Tolstoy preview, in the URL, copy the part after the https://player.gotolstoy.com/ and paste it into the script.
You are all set! You can paste the code to any button on your website where you prefer Tolstoy to appear.