本文介绍了jQuery blockUI判断页面或特定元素是否被阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以判断$ .blockUI();已被调用,但尚未调用$ .unblockUI()?理想情况下,这应该能够阻止整个页面和特定元素.

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.

我希望它能像这样

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

推荐答案

此处

  $(document).ready(function() {
    $('#demo14').click(function() {
        $.blockUI({
            fadeIn: 1000,
            timeout:   2000,
            onBlock: function() {
                alert('Page is now blocked; fadeIn complete');
            }
        });
    });

很明显,像onSuccess函数一样,有一个用于Block和unBlock的sorta.因此,在onBlock函数上,您只需设置一个全局布尔值即可.

Evidently there's one for Block and unBlock sorta like a onSuccess function. So on the onBlock function you'd simply just set a global boolean value.

希望这会有所帮助!

快乐编码! ;)

这篇关于jQuery blockUI判断页面或特定元素是否被阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 11:23
查看更多