Search code examples
loadingshadowbox

When using Shadowbox, how to keep the "loading ..." div displaying until the page is fully loaded?


I'm using shadowbox to open a page when a link is clicked and it does open the page when the link is clicked.

The problem is that "Loading ..." icon appears for 1 second then disappears whereas my page takes about 5 seconds to load.

How to keep the "loading ..." div displaying until the page is fully loaded and ready?

Many thanks,


Solution

  • Shadowbox.init({                
                onFinish: shadowboxFinish               
            });
    

    then

    function shadowboxFinish() {
    
                $("#sb-loading").show();
    
                $("#sb-player").load(function () {
    
                    $("#sb-loading").hide();
                 });               
            }