Skip to content

Instantly share code, notes, and snippets.

@barneycarroll
Created May 28, 2013 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barneycarroll/5663219 to your computer and use it in GitHub Desktop.
Save barneycarroll/5663219 to your computer and use it in GitHub Desktop.
API extension for Block UI (https://github.com/malsup/blockui) allowing to specify a given element and block every other element. Ideal for modal interactions etc where the rest of the UI is a clearly defined entity. $('#loginForm').blockRest() /* Only #loginForm is interactive */ .on('submit', function(){ $(this).unblockRest(); /* Releases the …
void function blockRest($){
function getRest(target){
var andParent = target.add(target.parents());
return andParent.siblings();
}
$.fn.blockRest = function(){
getRest(this).block();
return this;
}
$.fn.unblockRest = function(){
getRest(this).unblock();
return this;
}
}(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment