Using jquery global ajax for spinner and stuff
When using ajax calls to somewhere, and you have to add spinner to make it all better for ux,, you can use global calls for that,
/* make toggle nav on left */
$('.list-group a').click(function(){
$(this).siblings().removeClass('active');
$(this).addClass('active');
});
/* show spinner */
$( document ).ajaxStart(function() {
$('#spinner').removeClass('hidden');
});
/* hide spinner */
$( document ).ajaxStop(function() {
$('#spinner').addClass('hidden');
});
take a look here..
thsit, cheers :)
for demo I was using bootstrap from twitter
Written by kreso
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Jquery
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#