• Resolved nfong

    (@nfong)


    I have a newsletter subscription box that shows up in a boxzilla box only after scrolling down the page.
    It uses google recaptcha, which hurts pagespeed numbers.

    The newsletter JavaScript gets loaded on all pageviews, even if the boxzilla box is not visible.

    Is it possible to Load newsletter JavaScript code only When Boxzilla box is actually Visible?

Viewing 1 replies (of 1 total)
  • Plugin Contributor Lap

    (@lapzor)

    Hi, sorry for the late response, somehow a number of the WordPress .org forum notifications ended up in our spam folder…

    You can use the “box.show” event to detect the box being shown, and then loadd the Javascript dynamically.

    Boxzilla.on('box.show', function(box) {
       console.log("Showing box " + box.id);
    });

    https://kb.boxzillaplugin.com/javascript-events/

    Hope that helps. If you have any questions, please let me know!

Viewing 1 replies (of 1 total)
  • The topic ‘Load JavaScript When Box is Visible’ is closed to new replies.