Overview
jQuery BlockUI 插件可以在不同锁定浏览器的同时,模拟同步模式下发起Ajax请求的行为。该插件激活时,会组织用户在页面进行的操作,直到插件被关闭。BlockUI通过向DOM中添加元素实现其外观和组织用户交互的行为。
使用jQuery BlockUI,首先需要在jQuery后面引用 jquery.blockUI.js
jquery.blockUI.js插件下载地址:http://jquery.malsup.com/block/
使用自定义信息阻塞UI
Just a moment...' });
使用自定义样式阻塞UI
解除对页面的遮罩
如果你先要使用缺省设置对所有的ajax请求都使用UI遮罩,只需要添加下面语句即可
使用例子:
页面遮罩示例:
The following code is used on this page:
PHP', cache: }
test();
});
Just a moment...' });
test();
});
test();
});
test();
});
});
...
We are processing your request. Please be patient.
页面元素遮罩示例:
lorem ipsum dolor sit amet consectetuer adipiscing elit sed lorem leo lorem leo consectetuer adipiscing elit sed lorem leo rhoncus sit amet lorem ipsum dolor sit amet consectetuer adipiscing elit sed lorem leo lorem leo consectetuer adipiscing elit sed lorem leo rhoncus sit amet
The following code is used on this page:
});
message: Processing',
css: { border: });
});
});
alert( });
});
简单模态框示例:
with a custom message. Depending upon the user response (yes or no) an ajax call will be made while keeping the UI blocked.
The following code is used on this page:
});
Remote call in progress..." });
url: cache: complete: }
});
});
});
});
...
...
Would you like to contine?.
by Eric Martin or by Brice Burgess.
选项
message: Please wait...',
title: draggable:
theme:
css: {
padding: margin: width: top: left: textAlign: color: border: backgroundColor: cursor: },
themedCSS: {
width: top: left: },
overlayCSS: {
backgroundColor: opacity: cursor: },
cursorReset:
growlCSS: {
width: top: left: right: border: padding: opacity: cursor: color: backgroundColor: },
iframeSrc:
forceIframe:
baseZ:
centerX: centerY:
allowBodyStretch:
bindEvents:
constrainTabKey:
fadeIn:
fadeOut:
timeout:
showOverlay:
focusInput:
onBlock:
quirksmodeOffsetHack:
ignoreIfBlocked: };
- Globally,by directly overriding the values in the
object
- Locally,by passing an options object to the
(or
) function.
Global Overrides
Local Overrides
, , or functions. The exact same options are available to the local options object as are available in the global object. For example:
...
...
...
插件官网:http://jquery.malsup.com/block
其他参考博文:http://bookshadow.com/weblog/2014/09/26/jquery-blockui-js-introduction/
原文链接:https://www.f2er.com/jquery/403446.html