Created
May 28, 2013 14:38
-
-
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 …
This file contains 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
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