Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
HTML + JavaScript : Add class to documentElement immediately then remove it 1 sec after window loaded.
<script>document.documentElement.className += "loading";</script>
(function () {
'use strict';
function removeTheClass() {
var rootElement = document.documentElement;
if (rootElement.classList.contains('loading')) {
setTimeout(function () {
}, 1000);
window.onload = removeTheClass();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment