Help With Javascript

Need a simple javascript that calls/opens - motionAI_Open() on page load + 10 seconds.

This will trigger a modal window to open.

hey @JustinC, so i don’t know anything about motionAI so maybe if you give more details we can assist better.
But generally if you want to run some javascript code 10 seconds after page is loaded then you can do the following.

  1. First install the toolkit plugin.
  2. Then on the workflow page, create a custom event and in the action, choose Run javascript (this is will available after installing the toolkit plugin).
  3. Create another workflow, for When a page is loaded. In the action, select custom event, then Schedule a custom event.
  4. In the custom event name, select the custom event you created step 2 above, and for the delay enter 10 (for 10 secs or whatever delay you want)

So in summary what you’re doing is to run a javascript, 10 secs after the page is loaded.

Same here I have not used the motionAI_Open function before
But in case you are a coder…

Create a HTML element with the help of your bubble editor and paste the following into it

$(document).ready(function() {
setTimeout(function() {
motionAI_Open();
}, 10000);
});

Ensure that it is enclosed within the script tag and refer the correct parameters that have to be passed along with motionAI_Open()

It actually doesn’t say anything about paramaters in the documentation.

All it says is to “invoke motionAI_Open()” if that makes any sense?

Thanks for the help.

That actually worked well.

However is there a way to limit it so that it doesn’t open the modal window/chat box more than one or once the user clicks ‘close’ or ‘no’?

Right now it loads on page load every page of the website and opens up automatically.

You would then need to save the state as “no” when the user clicks no.
After that you would need to create a plugin using the above javascript and fire it only if the “state” is set to “yes”

This topic was automatically closed after 70 days. New replies are no longer allowed.