• Resolved colinb73

    (@colinb73)


    When the page in loading “Act aditional – Nr. 5324 din 27.10.2022” the pdf container width is ok.

    div class=”pdfemb-viewer” style=”width: 1100px; height: 1617.67px;”

    https://smtt.ro/acte-adtionale-csp/#1669109697596-6b1cc007-c240

    After click on the second “Act aditional – Nr. 4907 din 07.10.2022” or other links the pdf container width has the wrong width. The pdf container will be with correct width only after refresh page.

    div class=”pdfemb-viewer” style=”width: 597px; height: 843.68px;”

    I thik, the problem is on class=”pdfemb-viewer” style.

    Thx!

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

Viewing 1 replies (of 1 total)
  • Hi @colinb73,

    We are sorry for missing to reply in a timely manner.

    If you attempt to embed the PDF viewer within a tab that is controlled by JavaScript, you may find that it does not display at the correct size when the tab is opened. If you resize the browser window slightly, it should jump to the correct size. This is because the size was calculated when the tab was closed, and wasn’t updated for the size of the opened tab.

    You could modify the tab opening code to force a window resize event after the tab is open:

    window.dispatchEvent(new Event('resize'));
    

    If you have AJAX-style ‘smooth’ page transitions, perhaps provided by your theme, then you may find that the PDF viewer only displays at all when you load the page directly. Clicking on to the PDF’s page from a different page may miss out on the initialization code of the plugin.

    You might need to ensure that all relevant plugin JavaScript files are loaded, and then fire this event to initialize the plugin after the new page content has been loaded:

    jQuery('.pdfemb-viewer').pdfEmbedder();
    

    If that doesn’t work, the following bit of code can be tried (edit the?div.tab-title?to whatever class the tab is actually labeled with):

    <script>
         jQuery('div.tab-title').on('click',function() {
            setTimeout(
            function() {
              window.dispatchEvent(new Event('resize'));
           },
           100
           );
        });
     </script>
Viewing 1 replies (of 1 total)
  • The topic ‘Wrong width on the second link’ is closed to new replies.