Spinner while iframe loads

This is an implementation of a spinner while the iframe loads

by Joviano Dias

HTML

<button>Load Iframe</button>

<div id="overlay" style="display:none;">
    <div class="spinner"></div>
    <br/>
    Loading...
</div>

<iframe id="lh_report" style="display:none" src="http://www.columbia.edu/~fdc/sample.html">
  <p>
  This is my iframe
  </p>
</iframe>

CSS

#overlay {
  background: #ffffff;
  color: #666666;
  position: fixed;
  height: 100%;
  width: 100%;
  z-index: 5000;
  top: 0;
  left: 0;
  float: left;
  text-align: center;
  padding-top: 25%;
  opacity: .80;
}
button {
  margin: 40px;
  padding: 5px 20px;
  cursor: pointer;
}
.spinner {
    margin: 0 auto;
    height: 64px;
    width: 64px;
    animation: rotate 0.8s infinite linear;
    border: 5px solid firebrick;
    border-right-color: transparent;
    border-radius: 50%;
}
@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

JavaScript

$(document).ready(function() {
	$('button').click(function(){
		$('#overlay').fadeIn().delay(2000)
    $("#lh_report").css("display", "block")
    $('#overlay').fadeOut()
	});
});