display HTML page after loading complete

后端 未结 5 1674
忘掉有多难
忘掉有多难 2020-12-01 02:10

Is there a way to force the browser to display a page only after all of the page\'s contents are completely loaded (such as images, scripts, css, etc)?

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-01 02:50

    Hide the body initially, and then show it with jQuery after it has loaded.

    body {
        display: none;
    }
    
    $(function () {
        $('body').show();
    }); // end ready
    

    Also, it would be best to have $('body').show(); as the last line in your last and main .js file.

提交回复
热议问题