Last active
August 29, 2015 14:20
-
-
Save willbuilds/5d6fb9ee6ba4a55499b2 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
// General loadmasking for all ajax controls using jquery loadmask | |
// Prevents double requests and gives users better feedback ('Did i click that properly?'), especially on touch devices. | |
// On ajaxBefore (which equates to onclick in most cases) a mask will render over the target element | |
// On ajaxComplete the mask is destroyed. | |
// requires jquery.loadmask.js (@ https://code.google.com/p/jquery-loadmask/) | |
$(document).on('ajaxBefore', function(event, request) { | |
return $(event.target).mask('loading...'); | |
}).on('ajaxComplete', function(event, request) { | |
return $(event.target).unmask(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment