Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1357252

    I’d need an iframe full height, but did not managed to do it. Here is the the code I used on code block.

    #1357326

    Hey tammiviestinta,
    Thanks for posting your code block snippet, but your javascript has errors and the iframe had the height set to auto with inline css, below is the corrected script and the link to my test page.

    Best regards,
    Mike

    #1357329

    It looks good on your test page. What is still have wrong here?

    #1357338

    Hi,
    It looks like the same code I posted, did you check to ensure that the quotes didn’t turn into curly quotes when you copied the code?
    Otherwise, I will need to see a test page to see if you have any errors, as you noted this is working on my test page.

    Best regards,
    Mike

    #1357365

    Here is my testpage

    #1357392

    Hi,
    You have two errors, first your origin url is not wrapped in commas like the code I corrected above,
    you have: if(evt.origin !== https://www.your.site) return ;
    it should be: if(evt.origin !== 'https://www.your.site') return ;
    second error is that you are still using the jQuery statement for the iframe.height
    you have: iframe.height = ${evt.data.resize.height}
    it should be: iframe.height = evt.data.resize.height;
    So it looks like you are using the old code instead of the corrected code.
    If the code on your page backend is the new code I posted then you should try clearing your server cache, if it is an object-oriented cache such as Memcached, Redis, Varnish, Litespeed, etc. then it is still using the old page.
    Please review this code, note that the urls are not your so you will need to adjust.

    <iframe id="nw-kokonaistarjooma" style="width: 100%; border: none; margin: 0; padding: 0;" src="https://www.your.site/index.html"></iframe>
    
    <script>
    (function() {
    const iframe = document.querySelector('iframe#nw-kokonaistarjooma');
    window.addEventListener("message", evt => {
    if(evt.origin !== 'https://www.your.site') return ;
    if(evt.data.resize) {
    iframe.height = evt.data.resize.height;
    }
    });
    }());
    </script>

    Best regards,
    Mike

    #1357401

    Thank you! Now it works great.
    – I try to learn this by myself but sometimes it is not easy… :D

    #1357417

    Hi,

    Great, I’m glad that Mike could help you out. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1436890

    I am trying to use NEARLY the same code — but changing for another href. I am getting a page that has a tiny little horizontal iframe that you have to scroll down to see anything.

    Can you tell me what I have done wrong.

    Here is my ALB code
    [av_codeblock wrapper_element='' wrapper_element_attributes='' codeblock_type='' alb_description='' id='' custom_class='' template_class='' av_uid='av-ltlv93v7' sc_version='1.0']
    <iframe id=”nw-kokonaistarjooma” style=”width: 100%; border: none; margin: 0; padding: 0;” src=”https://mailchi.mp/4d1d48071937/grosh-photo-journal-kaluli-scripture-dedication-at-last?e=1d86365c3al”></iframe&gt;
    <script>
    (function() {
    const iframe = document.querySelector(‘iframe#nw-kokonaistarjooma’);
    window.addEventListener(“message”, evt => {
    if(evt.origin !== ‘https://mailchi.mp/4d1d48071937/grosh-photo-journal-kaluli-scripture-dedication-at-last?e=1d86365c3a&#8217;) return ;
    if(evt.data.resize) {
    iframe.height = evt.data.resize.height;
    }
    });
    }());
    </script>
    [/av_codeblock]

    Here is my trial page:

    Can you give me a clue, please?

    #1436892

    This is actually what’s used:

    [av_codeblock wrapper_element='' wrapper_element_attributes='' codeblock_type='' alb_description='' id='' custom_class='' template_class='' av_uid='av-ltlv93v7' sc_version='1.0']
    <iframe id=”nw-kokonaistarjooma” style=”width: 100%; border: none; margin: 0; padding: 0;” src=”https://mailchi.mp/4d1d48071937/grosh-photo-journal-kaluli-scripture-dedication-at-last?e=1d86365c3a”></iframe&gt;
    <script>
    (function() {
    const iframe = document.querySelector(‘iframe#nw-kokonaistarjooma’);
    window.addEventListener(“message”, evt => {
    if(evt.origin !== ‘https://mailchi.mp/4d1d48071937/grosh-photo-journal-kaluli-scripture-dedication-at-last?e=1d86365c3a&#8217;) return ;
    if(evt.data.resize) {
    iframe.height = evt.data.resize.height;
    }
    });
    }());
    </script>
    [/av_codeblock]

    #1436899

    Hi,
    This only works if the domain is yours, it looks like you are trying to use a mailchi.mp domain it will not work.

    Best regards,
    Mike

    #1436907

    Thanks, Mike, for answering so quickly.

    I tried a workaround, leaving in this code and just changing iframe info to include vh

    <iframe id=”nw-kokonaistarjooma” style=”width: 100vw; height: 100vh border: none; margin: 0; padding: 0;” src=”https://mailchi.mp/4d1d48071937/grosh-photo-journal-kaluli-scripture-dedication-at-last?e=1d86365c3a”></iframe&gt;

    This achieves enough of what I wanted to make me happy. Not sure the jquery is doing anything, maybe it’s all Iframe? Would be curious to know.
    But thanks again for your answer!

    #1436933

    Hi,
    Glad that you have sorted it out using width: 100vw; height: 100vh
    The javascript option above only works on same domain iframes
    If you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘iframe full height’ is closed to new replies.