Display a loading bar before the entire page is loaded

前端 未结 3 1083
名媛妹妹
名媛妹妹 2020-11-29 16:15

I would like to display a loading bar before the entire page is loaded. For now, I\'m just using a small delay:

$(document).ready(function(){
    $(\'#page\')         


        
3条回答
  •  猫巷女王i
    2020-11-29 16:51

    HTML

    I would like to display a loading bar before the entire page is loaded.

    JAVASCRIPT

    $(function() {
        $(".preload").fadeOut(2000, function() {
            $(".content").fadeIn(1000);        
        });
    });​
    

    CSS

    .content {display:none;}
    .preload { 
        width:100px;
        height: 100px;
        position: fixed;
        top: 50%;
        left: 50%;
    }
    ​
    

    DEMO

提交回复
热议问题