Issue with the form height when embedded in the Lightbox

  • Profile Image
    efenglishlive
    Asked on February 26, 2016 at 06:03 AM

    Hi, I have the issue with the forms height.

    As you can see in attached screenshoot, the from extend in a weird way to the bottom of the page. It might be important to note here that, I've used OptinMonster Lightbox PopUP  and embedded the form via iFrame.

    Can you please help troubleshoot what might be the solution for that issue?

    Thanks!

  • Profile Image
    Welvin
    Answered on February 26, 2016 at 09:19 AM

    Please share with us the page URL where the form is embedded so we can check it for you. But since you are using our iframe method, please try to remove the script part and adjust the iframe height value. See if that works.

    Here's an example of the iframe embed, remove the codes in yellow and use the codes in green.

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="https://form.jotform.com/60544963610960" frameborder="0" style="width:100%; height:539px; border:none;" scrolling="no"> </iframe> <script type="text/javascript"> window.handleIFrameMessage = function(e) { var args = e.data.split(":"); var iframe = document.getElementById("JotFormIFrame"); if (!iframe) return; switch (args[0]) { case "scrollIntoView": iframe.scrollIntoView(); break; case "setHeight": iframe.style.height = args[1] + "px"; break; case "collapseErrorPage": if (iframe.clientHeight > window.innerHeight) { iframe.style.height = window.innerHeight + "px"; } break; case "reloadPage": window.location.reload(); break; } var isJotForm = (e.origin.indexOf("jotform") > -1) ? true : false; if(isJotForm && "contentWindow" in iframe && "postMessage" in iframe.contentWindow) { var urls = {"docurl":encodeURIComponent(document.URL),"referrer":encodeURIComponent(document.referrer)}; iframe.contentWindow.postMessage(JSON.stringify({"type":"urls","value":urls}), "*"); } }; if (window.addEventListener) { window.addEventListener("message", handleIFrameMessage, false); } else if (window.attachEvent) { window.attachEvent("onmessage", handleIFrameMessage); } if(window.location.href && window.location.href.indexOf("?") > -1) { var ifr = document.getElementById("JotFormIFrame"); var get = window.location.href.substr(window.location.href.indexOf("?") + 1); if(ifr && get.length > 0) { var src = ifr.src; src = src.indexOf("?") > -1 ? src + "&" + get : src + "?" + get; ifr.src = src; } } </script>

    Adjust the height (red).

  • Profile Image
    efenglishlive
    Answered on February 26, 2016 at 09:55 AM

    OK, great stuff. Your suggested solution worked. Thanks!

  • Profile Image
    Welvin
    Answered on February 26, 2016 at 11:06 AM

    That's great to know. Please contact us again if we can help in any way.