How to Make a Script Run After X Amount of Time

Adding scripts gives your site extra functionality. When you add a script at page level, you can delay the firing of scripts after X amount of time using our Events, Actions, and Targets feature. Here’s how.

  1. In the Page Builder, click on Page in the top toolbar, then click on Custom Scripts.
  2. Click the Page tab, then click Add Page Script. Give your script a name (this is important because it allows your script to be targeted by Actions and Events).
  3. Add a description, and switch the script runs on page load toggle to Off.
  4. Next, choose the script position. If you are unsure where to put it, choose Body.
  5. Paste the code of your script into the box, and click Save.

Your script will be added, and a small red indicator will remind you that you need to republish your page(s) before you see the changes.

Next, we’ll add an Action at the page level to make the script fun after a certain amount of time.

  1. In the Menu Toolbar, click Actions.
  2. In the Elements Properties Panel, select Add New Action.
  3. Set up a new action with the following settings:

Event > Time > On time passed after page load
Action > Script > Run target script > 5 seconds
Target > Choose your script from the dropdown list

  4. Click Done. 

Now when you publish this page, your script will run 5 seconds after the page has loaded.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us