问题描述
我希望在某个操作时禁用所有页面元素.就像 JQuery UI 中的 modal 功能一样.
I wish to disable all page elements upon an action. Like the modal feature that is in the JQuery UI.
就像 ajax 动作一样.我希望显示通知,同时启用模态功能.并且请求后,需要重新启用页面元素回来.
Like on an ajax action.. I wish to show a notification and at the same time to enable the modal feature. And after the request, need to re-enable the page elements back.
在核心 jquery 中是否有任何可用的选项或任何插件?
Is there any option available in core jquery for that or any plugins?
推荐答案
页面元素没有被禁用 - 这样做会很乏味 - 而是在顶部覆盖了一个半透明的 div所有其他页面元素.为此,您可能会执行类似
The page elements are not disabled - doing that would be quite tedious - but rather, a semi-transparent div is overlayed on top of all other page elements. To do this, you would probably do something like
// Declare this variable in the same scope as the ajax complete function
overlay = $('<div></div>').prependTo('body').attr('id', 'overlay');
还有 CSS:
#overlay {
position: fixed;
height: 100%;
width: 100%;
z-index: 1000000;
background: url('link/to/semitransparent.png');
}
然后,一旦操作完成,您只需像这样删除它:
Then once the action is complete, you simply remove it like this:
overlay.remove();
如果这是您唯一需要的,则无需包含 jQuery UI.
No need to include jQuery UI if this is the only thing you need it for.
这篇关于使用 jquery 禁用所有具有模式功能的页面元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!





大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)