JSFiddle - React, Tailwind, and code Playground
by TimGThomas
HTML
<button class="start">Start a Long-Running Process</button>
<div class="container">
<div class="box pausable">The Supreme Dalek The socks with holes, dummy! The Silence is Coming! MY VISION IS IMPAIRED! Are you my mummy?</div>
<div class="box">IT is the Doctor! Enemy of the Daleks! EXTERMINATE! Galifreyan Hello Sweetie the oncoming storm.</div>
<div class="box pausable">The girl who waited Allons-y EXTERMINATE! River Song Bananas are good YOU WILL OBEY!</div>
</div>
CSS
/* Example Styles (the good stuff) */
.pausable {
position: relative;
}
.pausable:after {
content: " ";
display: none; /* Hide by default */
background-color: #fff;
background-color: rgba(255, 255, 255, 0.75);
background-image: url('http://ajaxload.info/images/exemples/4.gif');
background-position: center center;
background-repeat: no-repeat;
filter: alpha(opacity=75);
height: 100%;
width: 100%;
position: absolute;
z-index: 1;
left: 0px;
top: 0px;
}
body.paused .pausable:after { display: block; }
/* Visual styles (safe to ignore) */
body, button { font-family: Verdana; }
button {
cursor: pointer;
display: block;
margin: 10px auto;
padding: 5px 0;
width: 250px;
}
div { border: 1px solid #999; }
.container {
background: #ccc;
overflow: hidden;
margin: 0 auto;
padding: 10px 5px;
width: 396px;
}
.box {
background: #fff;
float: left;
font-size: 10px;
text-align: center;
margin: 0 5px;
overflow: hidden;
height: 76px;
width: 120px;
}
JavaScript
var $body = $('body');
var $start = $('.start');
function operationCompleted() {
$body.removeClass('paused');
$start.removeAttr('disabled');
};
$(function() {
$start.on('click', function() {
$body.addClass('paused');
$start.attr('disabled', 'disabled');
setTimeout(operationCompleted, 2500);
});
});