• Resolved solenec2121

    (@solenec2121)


    Hello,
    I am using a code module to display a newsletter subscription form. When I switch my section to a popup, the code module no longer appears in full.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Contributor Philipp Stracker

    (@strackerphil-1)

    Hi @solenec2121

    Thanks for reaching out, and sorry to hear about those issues!
    I’ve had a look at the website you mention, but I cannot find a Popup on that page.

    On your current page, I can see that you use an iframe and a custom js-file to collect newsletter leads. The iframe will display correctly inside Popups, but custom js-files are not working out-of-the-box.

    You need to dynamically load the js-file during the “area_show” event, because the Popup is not available in the DOM tree before it’s opened.

    Here’s a quick sample of such a dynamic loader:

    
    // Old code, does not work inside Popups:
    <script src="https://app.mailjet.com/statics/js/iframeResizer.min.js"></script>
    
    // New code, works inside Popups:
    <script>(function() {
      DiviArea.addAction('show_area', function(area) {
        var script = document.createElement('script');
        script.src = 'https://app.mailjet.com/statics/js/iframeResizer.min.js';
        document.head.appendChild(script);
      });
    })();</script>
    

    You can find more information on that snippet here: https://tinyurl.com/yjessqer

    The other option is switching to Divi Areas Pro, which has a smart-initialization logic that can handle custom scripts inside Popups.

    Let me know if you need further advice for this.
    – Philipp 🙂

Viewing 1 replies (of 1 total)

The topic ‘problem with the code module’ is closed to new replies.