How to show progress bar on web page until web page is fully loaded?

前端 未结 2 1558
轮回少年
轮回少年 2021-02-04 13:55

I would like to show a progress bar/loading popup in a web page until the page is fully loaded.

My web page is heavy because it contains an HTML editor in it, which is a

2条回答
  •  广开言路
    2021-02-04 14:31

    Don't know how to show a progress bar.
    But showing a loading popup is easy using jQuery BlockUI Plugin
    Just reference the jQuery and the BlockUi Plugin inside the head tag.

    Do something like this then.

    $(document).ready(function() { 
        // block page
        $.blockUI();
        //load your editor here
        //after load complete unblock page
        $.unblockUI();
    }); 
    

    Better still if you are using something like CKEditor, you can unblock the page after the load complete callback of the ckeditor.

    Here is a small example with a page being blocked for 10 seconds. You can set the same at your callback. ( Example Here )

提交回复
热议问题