Skip to content

Instantly share code, notes, and snippets.

@Farmatique
Created January 4, 2017 13:01
Show Gist options
  • Save Farmatique/a4e9de3e74ccd3cab170f8e61ef673a5 to your computer and use it in GitHub Desktop.
Save Farmatique/a4e9de3e74ccd3cab170f8e61ef673a5 to your computer and use it in GitHub Desktop.
preloader
jQuery(window).on('load', function () {
var $preloader = jQuery('#page-preloader'),
$spinner = $preloader.find('.spinner');
$spinner.fadeOut();
$preloader.delay(350).fadeOut('slow');
});
/* insert in the beggining of body or somewhere else */
<div id="page-preloader"><span class="spinner"></span></div>
#page-preloader {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: #fff;
z-index: 100500;
}
#page-preloader .spinner {
width: 32px;
height: 32px;
position: absolute;
left: 50%;
top: 50%;
background: url('../img/spinner.gif') no-repeat;
background-size: cover;
margin: -16px 0 0 -16px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment