禁用所有使用jQuery包括锚,段落标签的div内容? [英] Disable all div contents using jquery including anchor, paragraph tags?

查看:73
本文介绍了禁用所有使用jQuery包括锚,段落标签的div内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一点帮助在html css中,我想在用户通过jquery函数单击注销按钮后,在具有类main-wrapper的div中禁用所有内容,我尝试了两种方式,但徒劳无功!
这里是我的jquery函数,

i need a little help in html css, i want to disable all contents in a div having class "main-wrapper" after user clicks on a logout button through a jquery function, i tried in 2 ways, but in vain! here is my jquery function,

function loadLogoutBox() {
    $('#logout_box').fadeIn("slow");
    $(".main-wrapper").css({ // this is just for style
            "opacity": "0.3"  
    });
    $(".main-wrapper").disable();
    $(".top-menu").attr('disabled', true);

}

任何帮助!

推荐答案

如果我正确理解了你的话,你可以创建一个div,占用100%宽度和高度,透明背景并且显示在主包装上方和下方注销框。

If I understand you correctly, you can create a div that takes up 100% width and height with a transparent background and have it appear above the main wrapper and below the logout box.

HTML:

HTML:

<div id="cover"></div>

CSS:

CSS:

#cover {
  position: absolute;
  height: 100%;
  width: 100%;
  z-index: 1; /* make sure logout_box has a z-index of 2 */
  background-color: none;
  display: none;
}

jQuery:

jQuery:

function loadLogoutBox() {
    $("#cover").css("display", "block");
    $('#logout_box').fadeIn("slow");
    $(".main-wrapper").css({ // this is just for style
            "opacity": "0.3"  
    });
}

使用这种方法,您显然还必须添加一些jQuery以带走一旦用户返回到主屏幕,封面即可。

With this method, you will obviously also have to add some jQuery to take away the cover once the user returns to the main screen.

这可以简单地通过:

This can be done simply by:

$("#cover").css("display", "none");

这篇关于禁用所有使用jQuery包括锚,段落标签的div内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆