Search code examples
htmlloadingpopover

Prevent pop-over windows from loading as _blank


My previous question as been wrongly marked as duplicated and it seems it got lost without any answer. So I'm rewording it :

I'm using < a > links to open HTML files in pop-over windows (using Clearbox script). The problem is, if I click on it before the page is fully loaded, it opens itself in a _blank target. I don't want it to happen so I'm looking for a way to prevent those files from being loaded out of a Clearbox window.

I optimized the Clearbox script loading the best I could, which works better but still not perfectly. That's why I've been thinking about loading those < a > elements at the very end of my page's loading process. I'm not looking for a CSS fade-in effect as previously suggested, I just don't want the element to exist at all (or at least to be inactive) until everything else is loaded.

Do you have any idea to help me with this ?


Solution

  • you can hide links in css like:

    a{
        display:none;
    }
    

    and set their display to block when document is fully loaded:

    $(window).load(function(){  
        $("a").css("display", "block");
    });