Title: Load JavaScript When Box is Visible
Last modified: July 28, 2022

---

# Load JavaScript When Box is Visible

 *  Resolved [nfong](https://wordpress.org/support/users/nfong/)
 * (@nfong)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/load-javascript-when-box-is-visible/)
 * 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](https://wordpress.org/support/users/lapzor/)
 * (@lapzor)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/load-javascript-when-box-is-visible/#post-15984969)
 * 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/](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.

 * ![](https://ps.w.org/boxzilla/assets/icon-256x256.png?rev=1414640)
 * [Boxzilla - WordPress Popup Builder](https://wordpress.org/plugins/boxzilla/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/boxzilla/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/boxzilla/)
 * [Active Topics](https://wordpress.org/support/plugin/boxzilla/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/boxzilla/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/boxzilla/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Lap](https://wordpress.org/support/users/lapzor/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/load-javascript-when-box-is-visible/#post-15984969)
 * Status: resolved