javascriptwordpressshadowbox

Shadowbox onload not working


I'm really struggling with this...

I set up a really easy window.onload shadowbox.js popup window

However, when I try to use the same exact code on a dev wordpress site I'm creating, the shadowbox popup is not loading at all and I'm not sure why... what's weird is that everything for the shadowbow.js and css are loaded extrernally from a seperate directory, but it looks like my theme is taking over for controlling elements?

http://krimsonkloverdev.malbert.me/test/

I'm REALLY stumped on this, so if some kind soul can help me out with this or steer me in the right direction I would GREATLY appreciate it.

Thanks for reading.


Solution

  • Try adding popup open script in footer.php file. I mean the script below.

    <script type="text/javascript">
        Shadowbox.init({
        // let's skip the automatic setup because we don't have any
        // properly configured link elements on the page
        skipSetup: true
        });
        window.onload = function() {
        // open a welcome message as soon as the window loads
        Shadowbox.open({
        content: 'your-content-file-url',
        player: "iframe",
        height: 340,
        width: 540
        });
        };
    </script>
    

    NOTE : Make sure your change the content: url I hope this will solve the issue.

    Thanks