1$(window).on('load', function() { // makes sure the whole site is loaded
2 $('#status').fadeOut(); // will first fade out the loading animation
3 $('#preloader').delay(350).fadeOut('slow'); // will fade out the white DIV that covers the website.
4 $('body').delay(350).css({'overflow':'visible'});
5})
1<head>
2 <meta charset="utf-8">
3 <title>JS and CSS preload example</title>
4
5 <link rel="preload" href="style.css" as="style">
6 <link rel="preload" href="main.js" as="script">
7
8 <link rel="stylesheet" href="style.css">
9</head>
10
11<body>
12 <h1>bouncing balls</h1>
13 <canvas></canvas>
14
15 <script src="main.js" defer></script>
16</body>