Skip to content

Instantly share code, notes, and snippets.

@pavel-one
Created April 23, 2018 23:54
Show Gist options
  • Save pavel-one/911cf92c136457a0a829f8eb0a1738d2 to your computer and use it in GitHub Desktop.
Save pavel-one/911cf92c136457a0a829f8eb0a1738d2 to your computer and use it in GitHub Desktop.
preloader
function preloader(show) {
var template = '<div class="preloader" style="position: fixed;width: 100%;height: 100%;background: rgba(255,255,255,0.45);top: 0;left: 0;z-index: 99999;display: flex;justify-content: center;align-items: center;"><img src="preloader.svg"><div>';
if (show) {
$(template).appendTo('body');
return;
}
$(document).find('.preloader').remove();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment