jquery非常经典的等待提示插件,具体官网
http://jquery.malsup.com/block/
参数:
// override these in your code to change the default behavior and style $.blockUI.defaults = { // message displayed when blocking (use null for no message) message: '<h1>Please wait...</h1>', title: null, // title string; only used when theme == true draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) theme: false, // set to true to use with jQuery UI themes // styles for the message when blocking; if you wish to disable // these and use an external stylesheet then do this in your code: // $.blockUI.defaults.css = {}; css: { padding:0, margin:0, width:'30%', top:'40%', left:'35%', textAlign:'center', color:'#000', border:'3px solid #aaa', backgroundColor:'#fff', cursor:'wait', opacity:0.6 }, // minimal style set used when themes are used themedCSS: { width:'30%', top:'40%', left:'35%' }, // styles for the overlay设置覆盖层样式 overlayCSS: { backgroundColor:'#000', opacity:0.6, cursor:'wait' }, // style to replace wait cursor before unblocking to correct issue // of lingering wait cursor cursorReset: 'default', // styles applied when using $.growlUI growlCSS: { width:'350px', top:'10px', left:'', right:'10px', border:'none', padding:'5px', opacity:0.6, cursor:null, color:'#fff', backgroundColor:'#000', '-webkit-border-radius':'10px', '-moz-border-radius':'10px' }, // IE issues: 'about:blank' fails on HTTPS and javascript:false is slow // (hat tip to Jorge H. N. de Vasconcelos) iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', // force usage of iframe in non-IE browsers (handy for blocking applets) forceIframe: false, // z-index for the blocking overlay baseZ: 1000, // set these to true to have the message automatically centered centerX: true, // <-- only effects element blocking (page block controlled via css above) centerY: true, // allow body element to be stetched in ie6; this makes blocking look better // on "short" pages. disable if you wish to prevent changes to the body height allowBodyStretch: true, // enable if you want key and mouse events to be disabled for content that is blocked bindEvents: true, // be default blockUI will supress tab navigation from leaving blocking content // (if bindEvents is true) constrainTabKey: true, // fadeIn time in millis; set to 0 to disable fadeIn on block fadeIn: 200, // fadeOut time in millis; set to 0 to disable fadeOut on unblock fadeOut: 400, // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock 设置什么时间后遮罩消失单位毫秒 timeout: 0, // disable if you don't want to show the overlay是否显示背景遮罩 showOverlay: true, // if true, focus will be placed in the first available input field when // page blocking focusInput: true, // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) // no longer needed in 2012 // applyPlatformOpacityRules: true, // callback method invoked when fadeIn has completed and blocking message is visible遮罩完成后调用方法 onBlock: null, // callback method invoked when unblocking has completed; the callback is 取消遮罩后调用方法 // passed the element that has been unblocked (which is the window object for page // blocks) and the options that were passed to the unblock call: // onUnblock(element, options) onUnblock: null, // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 quirksmodeOffsetHack: 4, // class name of the message block blockMsgClass: 'blockMsg', // if it is already blocked, then ignore it (don't unblock and reblock) ignoreIfBlocked: false };
修改默认属性也非常简单可以使用下面两种方法:
1.全局的直接覆盖$.blockUI.defaults对象的属性
例如:
// change message border $.blockUI.defaults.css.border = '5px solid red'; // make fadeOut effect shorter $.blockUI.defaults.fadeOut = 200;
2.使用 blockUI
, unblockUI
, block
或 unblock
函数时传递局部对象覆盖
例如:
// change message border $.blockUI({ css: { border = '5px solid red'} }); // make fadeOut effect shorter $.unblockUI({ fadeOut: 200 }); // use a different message $.blockUI({ message: 'Hold on!' }); // use a different message $('#myDiv').block({ message: 'Processing...' });
说明:$.blockUI、$.unblockUI是针对真个页面遮罩而block、unblock是针对jquery选择的元素遮罩
相关推荐
总结,jQuery BlockUI 是一个简单易用的插件,能够帮助开发者快速实现页面的锁定和等待提示功能。通过灵活的配置和丰富的API,可以满足各种复杂的交互需求。在实际开发中,结合Ajax和其他jQuery方法,能为用户提供...
jQuery BlockUI 插件提供了一种简单而灵活的方式来实现这种效果,它允许开发者在页面上创建可自定义的“正在处理”或“请等待”提示,提升用户体验。 BlockUI 是一个流行的 jQuery 插件,由 Malsup 创建。它使得在...
**jQuery BlockUI 插件详解** 在前端开发中,我们经常需要在进行异步操作(如Ajax请求)时,防止用户交互对正在进行的过程造成干扰。这时,就需要用到一种称为“遮罩”或“锁定”的功能,使得用户界面在特定时段内...
在网页开发中,有时我们需要创建一个遮罩层或者弹出框来提示用户或者阻止用户与页面其他部分的交互,这就是“基于jQuery的BlockUI”插件所做的事情。BlockUI是一款非常实用的jQuery插件,它能够方便地实现页面区域的...
这时,我们可以使用jQuery BlockUI.js插件来创建一个加载提示,告诉用户数据正在加载,提高交互体验。BlockUI.js是jQuery的一个扩展,它能够方便地阻止用户与页面的交互,同时显示自定义的提示信息。 ## 一、jQuery...
《jQuery.blockUI.js插件详解:打造高效用户体验》 在Web开发中,提供良好的用户体验是至关重要的。当网站或应用程序正在进行耗时的操作时,如数据加载、提交表单或进行后台处理,用户可能会尝试进行其他操作,这...
《jQuery BlockUI插件详解与应用》 在Web开发中,用户体验是至关重要的,尤其是在进行异步操作(如Ajax请求)时,为了防止用户在数据处理完成前误操作,我们通常需要一种机制来暂时禁用页面上的交互。jQuery ...
《jQuery.blockUI插件的深度解析与应用》 在网页开发中,用户交互体验是至关重要的,尤其是在进行异步操作时,如何优雅地提示用户页面正在处理,避免误操作或重复提交,是开发者需要考虑的问题。jQuery.blockUI插件...
BlockUI是jQuery的一个扩展插件,它能够非常方便地将页面元素或者整个页面“阻塞”,显示一个自定义的提示信息,让用户知道后台正在处理数据。 **一、BlockUI的基本使用** BlockUI的核心功能是通过设置CSS样式来...
jQuery.blockUI.js插件就是为了解决这个问题而设计的,它能够方便地将页面部分或全部“锁定”,展示一个提示用户等待的遮罩层。本文将详细介绍这个插件的使用方法,并结合实际的示例代码进行解析。 首先,我们需要...
`jQuery.blockUI` 是一个非常实用的 jQuery 插件,用于在网页上模拟各种阻塞效果,例如加载提示、弹出对话框等,使得用户在等待页面处理时不会误操作。这个插件广泛应用于需要暂时禁用用户界面,或者显示等待动画的...
**jQuery BlockUI 插件详解** BlockUI 是一个流行的 jQuery 插件,它允许开发者轻松地在网页上创建页面或元素级别的遮罩效果,也就是在页面或特定元素上添加一个覆盖层,通常用于模拟页面加载状态或者阻止用户交互...
**jQuery.BlockUI 插件详解** 在Web开发中,弹出层是一种常见的用户交互元素,用于显示警告、提示、确认信息或加载等待等场景。jQuery.BlockUI是一个专门为jQuery设计的弹出层插件,它以其小巧的体积、易用性和强大...
`jQuery BlockUI` 是一个非常实用的jQuery插件,它允许开发者轻松地在网页上创建各种页面遮罩效果,常用于模拟页面加载或阻止用户与页面的交互。这个插件在许多网页应用中广泛使用,特别是在需要进行异步操作如数据...
jQuery BlockUI 是一款功能强大的JavaScript库,用于在网页上实现遮罩效果,它与jQuery库紧密结合,提供了简单易用的API来控制页面区域的“冻结”或遮罩,以达到用户交互时的提示或者加载等待体验。这款插件在开发...
例如,`jQuery.blockUI`是一个常用的阻止页面交互并显示加载提示的插件。它可以轻松地将页面部分或全部“锁定”,并显示自定义的加载消息: ```html <!-- 引入jQuery和blockUI插件 --> <script src="https://code....
jQuery.blockUI插件就是一个强大的工具,用于在网页上实现页面元素的锁定和提示功能,常用于加载提示、弹窗警告等场景。而dialog.js则是jQuery.blockUI插件中的一个关键组件,它负责构建和管理对话框。本文将深入...
总的来说,使用jQuery和blockUI插件实现一个带遮罩层效果的弹出层是一项非常实用的技术,它可以帮助开发者提升用户的操作体验,尤其是在需要进行长时间操作或等待响应时。通过上述方法,开发者可以轻松地将这类交互...
BlockUI 还可以与其他jQuery插件结合使用,如在表单提交时显示加载提示,或者在模态对话框中使用。你也可以在自定义的事件中触发BlockUI,例如在图片懒加载时显示加载提示。 总的来说,jQuery BlockUI 插件是提升...