HTML代码:

<input type="button" class="delete_btn" value="删 除" />
<div class="shade"></div>
<div class="warning">
  <div class="warn_titel">警 告</div>
  <div class="warn_context">
    您确定要删除吗?删除后,将不可恢复,请慎重!!!
  </div>
  <div class="warn_btn">
    <div class="warn_btn_t">确 定</div>
    <div class="warn_btn_f">取 消</div>
  </div>
</div>

CSS:

/*删除按钮*/
.delete_btn {
position: absolute;
width: 100px;
height: 30px;
cursor: pointer;
}
/*半透明遮罩*/
.shade {
position: fixed;
width: 100%;
height: 100%;
background-color: black;
opacity: 0.4;
z-index: 2;
display: none;
}
/*警告框*/
.warning {
position: fixed;
width: 400px;
top: 150px;
margin: auto;
background-color: white;
left: 50%;
top: 50%;
margin-left: -200px;
margin-top: -135px;
z-index: 3;
display: none;
}
/*警告框标题*/
.warn_titel {
position: relative;
width: 100%;
height: 60px;
color: red;
font-size: 28px;
line-height: 60px;
text-align: center;
}
/*警告框内容*/
.warn_context {
position: relative;
width: 70%;
left: 15%;
min-height: 100px;
font-size: 18px;
text-indent: 30px;
}
/*警告框按钮*/
.warn_btn {
position: relative;
width: 100%;
height: 50px;
}
/*警告框确定按钮*/
.warn_btn_t {
position: absolute;
width: 25%;
left: 15%;
height: 30px;
background-color: #79cdcd;
color: white;
cursor: pointer;
text-align: center;
line-height: 30px;
}
/*警告框取消按钮*/
.warn_btn_f {
position: absolute;
width: 25%;
right: 15%;
height: 30px;
background-color: #808080;
color: white;
cursor: pointer;
text-align: center;
line-height: 30px;
}

JS:

//按钮动画颜色
$(".warn_btn_t").hover(function () {
$(this).stop().animate({ "background-color": "red" }, 500);
}, function () {
$(this).stop().animate({ "background-color": "#79cdcd" }, 500);
});

$(".warn_btn_f").hover(function () {
$(this).stop().animate({ "background-color": "red" }, 500);
}, function () {
$(this).stop().animate({ "background-color": "#808080" }, 500);
});

//删除按钮弹出提示框
$(".delete_btn").click(function () {
$(".shade").fadeIn(200);
$(".warning").fadeIn(400);
});

//警告确定按钮
$(".warn_btn_t").click(function () {
$(".warning").fadeOut(200);
$(".shade").fadeOut(400);
//删除按钮功能
});
//警告取消按钮
$(".warn_btn_f").click(function () {
$(".warning").fadeOut(200);
$(".shade").fadeOut(400);
//不删除功能
});

效果展示:

JQuery 操作按钮遮罩(删除)的更多相关文章

  1. 简单的用jQuery做遮罩效果

    <!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8" ...

  2. 使用jQuery增加或删除元素(内容)

    使用jQuery增加或删除元素(内容):一.jQuery添加元素或内容:1,append() 方法:在被选元素的结尾插入元素或内容 2,prepend() 方法:被选元素的开头插入元素或内容. 3,a ...

  3. jQuery实现遮罩层

    1.1 背景半透明遮罩层样式 需要一个黑色(当然也可以其他)背景,且须设置为绝对定位,以下是项目中用到的css样式: /* 半透明的遮罩层 */ #overlay { background: #000 ...

  4. jQuery动态添加删除与添加表行代码

    具体实现代码如下: table的HTML如下: 代码如下 复制代码 <input type="button" value="添加一行" />< ...

  5. 基于jQuery图片遮罩滑动文字切换特效

    基于jQuery图片遮罩滑动文字切换特效.这是一款jquery hover鼠标滑动选项卡切换透明背景遮罩文字显示特效.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div ...

  6. 利用jQuery实现回收站删除效果

    jQuery是一款非常强大的Javascript脚本库,我们开发者喜欢jQuery的原因除了它代码简洁外,更多的是因为jQuery插件非常丰富.今天我们用一个示例来解说jQuery是如何实现拖拽的. ...

  7. jquery 添加与删除的规律 当要添加时候要定位到自己的父元素 当要删除时候 通过事件函数传入的this找到自己的父元素进行删除

    jquery 添加与删除的规律 当要添加时候要定位到自己的父元素  当要删除时候 通过事件函数传入的this找到自己的父元素进行删除

  8. jQuery动态添加删除CSS样式

    jQuery框架提供了两个CSS样式操作方法,一个是追加样式addClass,一个是移除样式removeClass,下面通过一个小例子讲解用法. jQuery动态追加移除CSS样式 <!DOCT ...

  9. 基于jQuery表格增加删除代码示例

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

随机推荐

  1. Android double输出时保留两位小数

    方法1,在代码中操作 this.totalTextview = (TextView) findViewById(R.id.package_total_money); double decimalBal ...

  2. 【转载】Hadoop机架感知

    转载自http://www.cnblogs.com/ggjucheng/archive/2013/01/03/2843015.html 背景 分布式的集群通常包含非常多的机器,由于受到机架槽位和交换机 ...

  3. vb6 获取 http only 的 Cookie

    Option Explicit ' No more data is available. ' The data area passed to a system call is too small. P ...

  4. MQTT服务器搭建-mosquitto1.4.4安装指南

    Mosquitto mosquitto是一款实现了 MQTT v3.1 协议的开源的消息代理服务软件. 其提供了非常轻量级的消息数据传输协议,采用发布/订阅模式进行工作,可用于物联设备.中间件.APP ...

  5. 安装jessie记录

    // */ // ]]>   安装jessie记录 Table of Contents 1 引言 2 目标 3 usb安装 4 无线网卡 5 代理上网 6 rabbitvcs 7 locale ...

  6. 利用硬链接和truncate降低drop table对线上环境的影响

    众所周知drop table会严重的消耗服务器IO性能,如果被drop的table容量较大,甚至会影响到线上的正常. 首先,我们看一下为什么drop容量大的table会影响线上服务 直接执行drop ...

  7. ReorderList 的使用

    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">       ...

  8. DBMS_JOBS

    http://blog.itpub.net/23055736/viewspace-1115938/

  9. php操作文件及下载图片脚本

    <?php set_time_limit(0); $handle = fopen('article.txt','r'); for($i=0;$i<1;$i++) { $count = 0; ...

  10. BRD

    搜索 复制