How to make JavaScript execute after page load?

前端 未结 24 2312
孤城傲影
孤城傲影 2020-11-21 05:55

I\'m executing an external script, using a

24条回答
  •  渐次进展
    2020-11-21 06:24

    $(window).on("load", function(){ ... });
    

    .ready() works best for me.

    $(document).ready(function(){ ... });
    

    .load() will work, but it won't wait till the page is loaded.

    jQuery(window).load(function () { ... });
    

    Doesn't work for me, breaks the next-to inline script. I am also using jQuery 3.2.1 along with some other jQuery forks.

    To hide my websites loading overlay, I use the following:

    
    

提交回复
热议问题