JavaScript Loading Screen while page loads

后端 未结 6 1273
无人共我
无人共我 2020-11-30 18:17

This is a little hard to explain, So I\'ll try my best

So while a HTML page loads, I\'d like there to be a cool loading screen going on. When it finishes loading, I

6条回答
  •  孤城傲影
    2020-11-30 18:28

    I would suggest adding class no-js to your html to nest your CSS selectors under it like:

    .loading {
        display: none;
     }
    
    .no-js .loading {
     display: block;
     //....
    }
    

    and when you finish loading your credit code remove it:

    $('html').removeClass('no-js');
    

    This will hide your loading spinner as there's no no-js class in html it means you already loaded your credit code

提交回复
热议问题