jquerydomiframeshadowbox

Pass document.ready() of iframe to parent container


Is there a way to pass the document.ready() of an iframe to the parent container?

My scenario is this:

External content is shown in an iframe in a Shadowbox. The shadowbox overlay (#sb-overlay) has a background with a loading icon. I now would like to remove the loading icon, when the content in the iframe has completely loaded.

Thanks!


Solution

  • Here's the code, that got it working for me:

    $('.iframelink').on('click', function(){
        setTimeout(function(){
            $('iframe').load(function(){
                $('#sb-overlay').css('background-image','none');
                console.log('loaded');
            });
        }, 1000);
    });