• Works fine until I use a jQuery.ajax function to populate an unrelated div within the page. After that, no triggers from the class, href, or span will make the popup appear again.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter rbconsult

    (@rbconsult)

    It appears that any newly generated buttons don’t trigger the modal. Buttons that remain on the page work fine before and after the ajax call. Buttons that are generated as a result of the ajax call will not open the modal. Any help is appreciated. Thanks.

    Plugin Author Wow-Company

    (@wpcalc)

    Hello.

    Can you send the link to the page with issue and code of jQuery.ajax function which you use?

    Thread Starter rbconsult

    (@rbconsult)

    My apologies, it seems to be working now. Initially, buttons generated from an AJAX call (i.e. didn’t exist on first load) weren’t triggering the modal via a class/click event. They are now. All good. Great addon, thanks!

    Thread Starter rbconsult

    (@rbconsult)

    So, it came back. Buttons that don’t exist on page load and are generated from javascript will not trigger the open or close of these modals.

    Here’s how I got around it. Kinda hacky, but it works.

    //Force open
    await fadeIn(‘wow-modal-overlay-4’, 500);
    await fadeIn(‘wow-modal-window-4’, 500);

    //Force close
    await fadeOut(‘wow-modal-window-4’, 500);
    await fadeOut(‘wow-modal-overlay-4’, 500);

    async function fadeIn(id, ms){
    document.getElementById(id).style.opacity = 0;
    document.getElementById(id).style.display = “block”;
    for (let i = 1; i < 100; i++) {
    await sleep(ms / 100);
    document.getElementById(id).style.opacity = (i / 100);
    }
    }

    async function fadeOut(id, ms){
    document.getElementById(id).style.opacity = 1;
    for (let i = 100; i > 1; i–) {
    await sleep(ms / 100);
    document.getElementById(id).style.opacity = (i / 100);
    }
    document.getElementById(id).style.display = “none”;
    }`

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can’t trigger after AJAX call’ is closed to new replies.