Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1367335

    Hi,
    I am trying to open a link to a Google Doc in a lightbox using ?iframe=true. It opens in the iframe but immediately scrolls to the top of the page so that the user has to scroll back down in order to see the lightbox. This isn’t happening with any other external link that I tried. Do you know why this happens and if there is a solution?

    #1367345

    Hey TOTL,
    Thanks for the link to your page, I tried to create a test page on my demo for this and I notice that the google spreadsheet link is causing a few errors, first is a jQuery error for Syntax error, unrecognized expression: #gid=9882246?iframe=true this points to the link having a hashtag and question mark causes an error:
    2022-10-02_005.jpg
    since the google link needs the hashtag and the lightbox needs the question mark, I don’t see a way around this. Javascript errors tend to spill down to other functions and scripts.
    Once the google spreadsheet is loaded in the lightbox more errors occur about Refused to frame because an ancestor violates the following Content Security Policy directive
    2022-10-02_006.jpg
    I have not seen this before.
    So on my test page I uploaded a text document to my site and created a button with the custom class iframe-button and this code in a code block element:

    <script>
    (function($) {
    $(".iframe-button").on('mousedown', function(e) {
            e.preventDefault();  
     $("html").css({'overflow-y':'hidden'});               
    });
    $('body').on('click', function() {
            setTimeout( function() {
              if($('.mfp-bg').length == 0) { 
                $('html').css({'overflow-y':'scroll'});
              }
            },500); 
    });
    }(jQuery)); 
    </script>

    2022-10-02_007.jpg
    and this solved the scrolling of the page for the first button.
    But for the second button with the google spreadsheet link this didn’t help.
    even adding the google spreadsheet as an iframe on another page and linking to that page in the button as the lightbox still scrolled.
    Try taking a screenshot of the google spreadsheet and using that in the lightbox.

    Best regards,
    Mike

    #1368302

    or try that new filter in your child-theme functions.php:

    add_filter( 'avf_default_lightbox_no_scroll', '__return_true' );
    
    #1368319

    Hi,

    Thanks for helping out @guenni007 :-)

    Best regards,
    Rikard

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.