Created
January 2, 2020 02:45
-
-
Save noobalex/a2fcc2a8373ee45a1d459aaa14769d7f to your computer and use it in GitHub Desktop.
页面延迟加载
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.page{position:relative;-ms-flex-direction:column;flex-direction:column;min-height:100vh} | |
.page-loading{background:center no-repeat;background-size:auto} | |
.js-hidden{display:none!important} | |
</style> | |
<div id="page-loading" class="page page-loading" style="background-image:url(../../img/loading-0.gif)"></div> | |
<div id="app" class="page js-hidden"> | |
</div> | |
<script type="text/javascript"> | |
window | |
.addEventListener("load", function () { | |
!function () { | |
var e = document.getElementById("app"); | |
document.getElementById("page-loading") | |
.classList | |
.add("js-hidden"), | |
e.classList.remove("js-hidden") | |
}() | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment