• Resolved paulewhite

    (@paulewhite)


    I have created a popup which includes a part of text and the shortcode of a video.

    I have set its position to center with auto height but when I open it, the text is shown immediately while the video takes a couple of seconds to load.

    For this reason, the popup is centered on the basis of the text and when the video appears, it partially disappears beyond the bottom part of the screen.

    I have then set the height to the video height value and this works on a wide screen but in mobile view, the box is too big and there is an empty background.

    A possibile solution would be to position the popup top-center but this is not possible.

    Have you got any suggestion?

    The website is under construction so I can not provide a URL.

    Thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Damian

    (@timersys)

    LEt’s try something out. Add in your functions.php the following

    add_action(‘wp_footer’, function(){
    ?>
    <script>
    window.wp.hooks.addAction( ‘wppopups.popup_opened’, ‘wppopups’, window.wppopups.centerPopup, 99 );
    </script>
    <?php

    },99);

    Thread Starter paulewhite

    (@paulewhite)

    Hi Damian,

    Thanks for your reply. Unfortunately, I have edited the functions.php file and cleared the browser cache but the behavior is the same.

    Plugin Author Damian

    (@timersys)

    It’s hard to assist without seeing the actual error. Do you see anything on the browser console. Does the provided code is being executed?

    Thread Starter paulewhite

    (@paulewhite)

    No, I don’t see anything on the browser console and the code appears on the page.

    I have recorded the screen to show you what happens: shorturl.at/mwOWX

    I hope it helps.

    Plugin Author Damian

    (@timersys)

    You do you know that photogrpahic album loads? It does have any way to execute javascript once loaded?
    Because we do hook to the window on load to center popups once every asset it’s loaded but is not the case with your photo album.

    Another dirty solution could be to set a timeout and center after a few secs

    add_action(‘wp_footer’, function(){
    ?>
    <script>
    setTimeout(function() { window.wppopups.centerPopup, 99 ) },3000);
    </script>
    <?php
    
    },99);
    Thread Starter paulewhite

    (@paulewhite)

    I have solved by adding the following code to the CSS:

    .spu-box#spu-535 {
    	top: 40px!important;
    	right: auto!important;
    	left: auto!important;
    }
    

    In this way, the popup appears centered on top of the page and the loading time is not a problem.

    Do you think it is OK too?

    Thank you

    Plugin Author Damian

    (@timersys)

    Hi Paul,
    as long as it works for you it’s perfect ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Wrong positioning’ is closed to new replies.