Created
August 27, 2013 06:55
-
-
Save tournasdim/6350415 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Start by setting display:none to make this hidden. | |
Then we position it in relation to the viewport window | |
with position:fixed. Width, height, top and left speak | |
speak for themselves. Background we set to 80% white with | |
our animation centered, and no-repeating */ | |
.modal { | |
display: none; | |
position: fixed; | |
z-index: 1000; | |
top: 0; | |
left: 0; | |
height: 100%; | |
width: 100%; | |
background: rgba( 255, 255, 255, .8 ) | |
url('http://i.stack.imgur.com/FhHRx.gif') | |
50% 50% | |
no-repeat; | |
} | |
/* When the body has the loading class, we turn | |
the scrollbar off with overflow:hidden */ | |
body.loading { | |
overflow: hidden; | |
} | |
/* Anytime the body has the loading class, our | |
modal element will be visible */ | |
body.loading .modal { | |
display: block; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="modal"><!-- Place at bottom of page --></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("body").on({ | |
ajaxStart: function() { | |
$(this).addClass("loading"); | |
}, | |
ajaxStop: function() { | |
$(this).removeClass("loading"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment