JSFiddle - React, Tailwind, and code Playground

by tonyleeper

HTML

<div class="lightsout">
    <div class="loader-outer"></div>
</div>

CSS

* {
    margin: 0;
    padding: 0;
}

html, body {
    height:100%;
}

.lightsout {
    background: black;
    opacity: .9;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.loader-outer {
    position: absolute;
    top: 50%;
    margin-top: -45px;
    left: 50%;
    margin-left: -45px;
    width: 60px;
    height: 60px;
    border: 15px solid white;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-radius: 50%;
    -webkit-animation: spin .8s infinite ease-in-out;
}

@-webkit-keyframes spin {
    0% {
        -webkit-transform: rotate(0deg);
    }
    
    100% {
        -webkit-transform: rotate(360deg);
    };
}

JavaScript

/**
    Lightsout Loader
*/

$(document).click(function () {
    $(".lightsout").stop(true, true).fadeToggle(200);
});