15 karma · joined February 20, 2012
Duolingo - a fun and free way to learn a new language before your next trip Evernote - write, collect and find what matters to you, with a full-size keyboard and touchscreen Sight Words - a delightful way for you to help improve your child's reading skills Vine - create short, beautiful, looping videos in a simple and fun way
var loadingLayer = { step: 0, add: function(){ this.step += 1; //didn't know how to call checkState() automatically after any other call this.checkState(); }, remove: function(){ this.step -= 1; this.step < 0 && (this.step=0); this.checkState(); }, clear: function(){ this.step = 0; this.checkState(); }, checkState: function(){ if (this.step === 0){ $("body").removeClass("loading"); } else { $("body").addClass("loading"); } } }; $(document).ajaxStart( function(){ loadingLayer.add(); }); $(document).ajaxComplete(function(){ loadingLayer.remove(); });
I know the JS is uggly but i'm not an js expert (it works).