How to make my Roadmap iFrame full height?

How to make my Roadmap iFrame full height?

Unfortunately there is no "easy" way to dynamically set the iFrame's height based on its content, however, there is a useful solution which is what we have implemented on our own website here https://www.productstash.io/our-roadmap

This solution is taken from this StackOverflow solution:

-----

  1. Add the following iFrame snippet to your website HTML, adding in your public roadmap URL:

    <div> <iframe id="IframeId" src="YOUR_ROADMAP_URL" style="width:100%;" onload="setIframeHeight(this)"></iframe> </div>

  2. Next you need to add the following JavaScript snippet to your website HTML:

window.addEventListener('message', function (event) {
if (event.data.hasOwnProperty("FrameHeight")) {
        $("#IframeId").css("height", event.data.FrameHeight);        
    }
});

Next you need to add another JavaScript snippet (below). On iFrame load you have to send message to iFrame window content with "FrameHeight" message. This function is already being called through the "onload" property on the iFrame snippet from step 1, but it's not been added to your website HTML yet, so add this:


function setIframeHeight(ifrm) {
   var height = ifrm.contentWindow.postMessage("FrameHeight", "*");   
}

  1. You're done! The public Productstash roadmap page takes care of the next step and dynamically sets the iFrame height accordingly based on the content. For clarity, the third step from the StackOverflow solution (outlined below), does not need to be done by you - this is already implemented within Productstash.
window.addEventListener('message', function (event) {

   if (event.data == "FrameHeight") {
        var body = document.body, html = document.documentElement;
        var height = Math.max(body.scrollHeight, body.offsetHeight,
            html.clientHeight, html.scrollHeight, html.offsetHeight);

        event.source.postMessage({ "FrameHeight": height }, "*");       
    }
});

    • Related Articles

    • How do I add videos to my content?

      How do I add videos? Method 1 - Insert videos via direct link The easiest way to include videos in your content is by inserting them via a direct link. Simply click on the video icon and then paste in the video's URL. Once added, this will render the ...
    • Objectives, Categories and Tags

      Roadmap Objectives Roadmap Objectives are typically used as roadmap themes, or goals, and are used to group similar cards together - these could be used as competencies in your case perhaps. These types of roadmaps focus on goals and objectives and ...
    • Quick Start Guide

      The Basics Welcome to LoopedIn! Before we jump into configuring the app, it's important to go over some of the key components to LoopedIn. LoopedIn is made up of Workspaces. A Workspace can mean different things to different people. They could ...
    • How do custom domains work?

      Overview A custom domain can be added to your account from your account settings page. Read more here to understand how to add your domain. How do they work? Once you have added your custom domain, your domain will effectively replace ...
    • Adding a custom domain

      Overview You can access Productstash and your public boards via your own domain by configuring a domain and adding a flattened CNAME or ANAME/ALIAS record to your DNS settings. What is an ANAME/ALIAS/CNAME flattening?  An ANAME record is ...