<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<p class="explanation">JavaScript runs a counter checking if the browser is idle. If it's been idle for long enough (3 seconds) then it adds an 'idle' class to the HTML element. This fades in an overlay making the screen go darker until the user wakes it up again. CSS transitions make it all smoother.</p>
<div id="overlay"></div>