문제

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:

http://jsfiddle.net/nAQ94/

$.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}

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top