jquery blockUI tell if page or specific element is blocked

will picture will · Oct 26, 2011 · Viewed 7.3k times · Source

Is there a way to tell if $.blockUI(); has been called but $.unblockUI() has not been called? Ideally this should be able to work for both blocking the full page and specific elements.

I'd expect it to work something like this

> $.blockUI();
> $.isBlockUI?():
>> true
> $.unblockUI();
> $.isBlockUI?();
>> false

Answer

Oleg picture Oleg · May 23, 2012
var data = $('#element').data();
//will return Object like: { blockUI.isBlocked=1, blockUI.onUnblock=null} 

if (data["blockUI.isBlocked"] == 1)
// is blocked
else
// is not blocked