Please propose an option that would allow to to display the form after a specific time, just like for the pop-up component.
Thanks!
2 Likes
Hi there, @Marketing_Ops
Glad to say that it’s possible to achieve this! You just need to add this code next to your widget’s installation code:
<script>
const buttonSelector = ".es-forms-floating-button";
const listenDelay = 100;
const listenLimit = 500;
function listenForElement(elem, selector, delay, step, limit, resolve, reject = () => { }) {
elem = document.querySelector(selector);
if (!elem) {
step++;
if (step < limit)
setTimeout(() => {
listenForElement(elem, selector, delay, step, limit, resolve, reject);
}, delay);
else
reject();
}
else {
resolve(elem);
}
}
function onButtonFound(button) {
button.click();
}
window.addEventListener("load", () => {
let button;
let step = 0;
listenForElement(button, buttonSelector, listenDelay, step, listenLimit, onButtonFound);
});
</script>
In the 3rd line of the code, you can set the delay in milliseconds. GIve it a try and let me know how it worked
1 Like