罗田县升平网络工作室,一家专业从事网站建设的工作室

资讯论坛

 找回密码
 加入论坛

快捷登录

回帖中禁止出现的内容,违者将被直接永久禁止访问,删除ID处理 :1.违反法律法规 ,包括但不限于出现带有政治、色情、暴恐信息等内容;2.恶意攻击内容,包括但不限于:恶意攻击党和政府、辱骂跟帖者、攻击主题发布者、不服从论坛管理、挑衅管理者、挑战版规等;3.广告、推广内容,尤其出现带有病毒、恶意代码、广告链接等内容,包括但不限于:QQ号、文字QQ号、微信号、手机号、文字手机号、第三方网址、单位公司名称、网站名称等;4.回帖贴出该主题隐藏资源链接或其它主题隐藏资源链接的行为。
查看: 636|回复: 0

JavaScript实现的弹出遮罩层特效经典示例【基于jQuery】

[复制链接]

694

主题

735

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
19765
发表于 2019-10-22 12:51:41 | 显示全部楼层 |阅读模式

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.   <meta charset="UTF-8">
  5.   <title>查看,修改,删除</title>
  6.   <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
  7.   <style>
  8.     table{
  9.       width:500px;
  10.       border:1px solid blue;
  11.       border-collapse: collapse;
  12.     }
  13.     table th{
  14.       border:1px solid blue;
  15.       height:30px;
  16.     }
  17.     table td{
  18.       border:1px solid blue;
  19.       text-align:center;
  20.       height:30px;
  21.     }
  22.     table td a {
  23.       color:red;
  24.     }
  25.     div.proDiv{
  26.       width:500px;
  27.       position: absolute;
  28.       left:50%;
  29.       margin-left:-250px;
  30.       padding:10px;
  31.       border:1px solid red;
  32.       top:100px;
  33.       background: #fff;
  34.       display: none;
  35.       z-index: 3
  36.     }
  37.     div.proDiv p{
  38.       border-bottom:1px solid red;
  39.     }
  40.     div.proDiv a.close{
  41.       color:red;
  42.     }
  43.   </style>
  44. </head>
  45. <body>
  46.   <table>
  47.     <tr>
  48.       <th>姓名</th>
  49.       <th>年龄</th>
  50.       <th>工作</th>
  51.       <th>工资</th>
  52.       <th>操作</th>
  53.     </tr>
  54.     <tr>
  55.       <td>张三</td>
  56.       <td>22</td>
  57.       <td>项目经理</td>
  58.       <td>12000</td>
  59.       <td>
  60.         <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="view">查看</a>
  61.         <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >修改</a>
  62.         <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="del">删除</a>
  63.       </td>
  64.     </tr>
  65.     <tr>
  66.       <td>李四</td>
  67.       <td>24</td>
  68.       <td>前端工程师</td>
  69.       <td>10000</td>
  70.       <td>
  71.         <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="view">查看</a>
  72.         <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >修改</a>
  73.         <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="del">删除</a>
  74.       </td>
  75.     </tr>
  76.     <tr>
  77.       <td>王五</td>
  78.       <td>21</td>
  79.       <td>java工程师</td>
  80.       <td>12000</td>
  81.       <td>
  82.         <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="view">查看</a>
  83.         <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >修改</a>
  84.         <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="del">删除</a>
  85.       </td>
  86.     </tr>
  87.   </table>
  88.   <div class="proDiv">
  89.     <p><strong>姓名:</strong><span></span></p>
  90.     <p><strong>年龄:</strong><span></span></p>
  91.     <p><strong>工作:</strong><span></span></p>
  92.     <p><strong>工资:</strong><span></span></p>
  93.     <a class="close" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >关闭</a>
  94.   </div>
  95. </body>
  96. <script>
  97.   //查看操作
  98.   $('a.view').click(function(){
  99.     //获取文档的宽和高
  100.     var maskWidth = $(document).width();
  101.     var maskHeight = $(document).height();
  102.     //遮罩层初始化
  103.     $('<div class="mask"></div>').appendTo($('body'));
  104.     $('div.mask').css({
  105.       'position':'absolute',
  106.       'top':0,
  107.       'left':0,
  108.       'background':'black',
  109.       'opacity':0.5,
  110.       'width':maskWidth,
  111.       'height':maskHeight,
  112.       'z-index':2
  113.     });
  114.     var data = [];//保存数据的数组
  115.     //将一行的数据添加到数据中
  116.     $(this).parent().siblings().each(function(){
  117.       data.push($(this).text())
  118.     });
  119.     //将内容显示到弹出层中
  120.     $('div.proDiv').children().each(function(i){
  121.       $(this).children('span').text(data[i]);
  122.     });
  123.     $('div.proDiv').show();//显示弹出层
  124.     //关闭操作
  125.     $('a.close').click(function(){
  126.       $(this).parent().hide();
  127.       $('div.mask').remove();
  128.     });
  129.   });
  130.   //删除操作
  131.   $('a.del').click(function(){
  132.     $(this).parents('tr').remove();
  133.   });
  134. </script>
  135. </html>
复制代码
打赏鼓励一下!
回复

使用道具 举报

回帖中禁止出现的内容,违者将被直接永久禁止访问,删除ID处理 :1.违反法律法规 ,包括但不限于出现带有政治、色情、暴恐信息等内容;2.恶意攻击内容,包括但不限于:恶意攻击党和政府、辱骂跟帖者、攻击主题发布者、不服从论坛管理、挑衅管理者、挑战版规等;3.广告、推广内容,尤其出现带有病毒、恶意代码、广告链接等内容,包括但不限于:QQ号、文字QQ号、微信号、手机号、文字手机号、第三方网址、单位公司名称、网站名称等;4.回帖贴出该主题隐藏资源链接或其它主题隐藏资源链接的行为。

浏览排行

(38463)2019-11-5 公共云钱包资金盘骗局揭秘: 网络传销+原始股骗局合体!

(22233)2019-12-20 12月17日 邓智天法院直播庭审疑问全解答!

(20722)2019-12-1 环保币GEC资金盘骗局最新消息: 即将崩盘!

(17244)2019-11-9 巨胸肥臀大长腿,嫩模糯美子真人COS不知火舞福利污图

(15868)2018-12-24 罗田县人民法院公布【第五批失信被执行人名单】 ...

(14972)2019-11-3 曝光!PTFX已经崩盘跑路,投资者血流成河!

(13018)2019-8-7 湖北电力网上缴费,支付宝绑定户号的初始密码是什么?

(12480)2018-10-17 罗田县人民政府“12345”市民服务热线服务指南

(11170)2019-12-11 公安定性了, 趣码是非法传销! 趣码怎么退回365元?

(11081)2019-12-15 满足你对女同事的幻想 风骚秘书阿朱销魂眼神勾魂摄魄

最新发表

[升平网络工作室]2025-8-23 [2025-08-23]罗田天气预报

[升平网络工作室]2025-8-23 西藏自治区成立60周年庆祝大会隆重举行 习近平出席大会

[升平网络工作室]2025-8-23 县委委员会召开查摆问题整改整治情况汇报会

[爱查小程序]2025-8-22 [爱查]在线听音乐操作说明

[升平网络工作室]2025-8-22 [2025-08-22]罗田天气预报

[升平网络工作室]2025-8-22 习近平率中央代表团抵达拉萨出席西藏自治区成立60周年庆祝活动

[升平网络工作室]2025-8-22 县关工委联合经济开发区开展“情系学子”助学活动 助力职工子女圆梦大学

[升平网络工作室]2025-8-21 2025年罗田县卫健系统赴高校公开招聘事业单位工作人员拟聘用人员公示公告

[升平网络工作室]2025-8-21 [2025-08-21]罗田天气预报

[升平网络工作室]2025-8-21 县安防委2025年度第三次全体(扩大)会召开

QQ|Archiver|手机版|小黑屋|资讯论坛BBS.SPW8.CN ( 鄂ICP备2021011341号-3 )|网站地图


手机扫一扫继续访问
[免责声明]
本站系本网编辑转载,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。
如涉及作品内容、版权和其它问题,请在30日内与本网联系,我们将在第一时间删除内容!
[声明]本站文章版权归原作者所有 内容为作者个人观点 本站只提供参考并不构成任何投资及应用建议。

进入社区 | 发表新帖 | 百度收录 |
技术提供:罗田县升平网络工作室
站长Email:admin@spw8.cn
投诉电话(刮开查看):15374567400

GMT+8, 2025-8-23 20:17 , Processed in 0.255163 second(s), 29 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表