Very similar to this question, except I'm not blocking a particular element, I'm blocking the whole page.
So instead of:
$('div.test').block({
message: '<h1>Processing</h1>',
css: { border: '3px solid #a00' }
});
I'm doing:
$.blockUI({
message: $('#divModal1'),
css: { cursor: 'default' }
});
I've tried using html
and body
as the selector..
var data = $('html').data();
if (data['blockUI.isBlocked'] == 1) {
alert('blocked');
}
else {
alert('not blocked');
}
But data['blockUI.isBlocked']
is always 'undefined'
I reviewed the source; it looks like the data is being written to window
, not to html
or body
. See fiddle here:
$.blockUI({
message: $('#divModal1'),
css: { cursor: 'default' }
});
console.log($(window).data());
The console.log
call returns the following object:
> Object {blockUI.history: Object, blockUI.onUnblock: null, blockUI.isBlocked: 1}