Issue
As a member of the community, I am wondering how I can show a modal on page load.
Resolution
To display a modal when the page loads, follow these steps:
-
Create a JSObject and add a function
showModalOnPageLoad()
with the following code. Replace'Modal1'
with the name of your modal:export default { showModalOnPageLoad() { showModal('Modal1'); } }
- Click the Settings tab in the JS Object and toggle the button under the Run On Page Load attribute for the
showModalOnPageLoad
function. This will ensure the function runs automatically when the page loads. - Deploy your app and test it to confirm that the modal displays as expected when the page loads.