温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

js+html5实现半透明遮罩层弹框效果

发布时间:2020-10-22 23:07:50 来源:脚本之家 阅读:250 作者:ouqi_qiou 栏目:web开发

点击按钮,出现半透明遮罩层弹框,说说自己之前发过的愁吧

1、遮罩层半透明了 弹框也跟着半透明了 就像这样 绝望吧 

js+html5实现半透明遮罩层弹框效果

是哪里错了呢?你的css是这样写的吧:

js+html5实现半透明遮罩层弹框效果

应该这样:

js+html5实现半透明遮罩层弹框效果

需要注意的是这几个参数的意思:RGB Red Green Bule 3色!及212, 0, 0 三色的值混合 .最后一个参数 0.5 是指的透明度 1表示不透明

2、半遮罩层里面的内容可以上下滑动 感觉挺好玩的 /笑哭

修改就是把半遮罩层的position设置为fixed 里面的内容就不会变啦

接下来就是代码show

<!doctype html>
<html>
 <head>
 <meta charset="UTF-8">
 <title></title>
 <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
 <style type="text/css">
  *{
  margin: 0;
  padding: 0;
  }

 .tip{
  text-align: center;
  position: absolute;
  height: 100%;
  width: 100%;
  background-color: rgba(90, 90, 90, 0.5);
  z-index: 99999;
  }
  
  .collectSucc{
  position: fixed;
  height: auto;
  width: 70%;
  background-color: #ffffff;
  margin-left: 15%;
  margin-top: 50%;
  }
  
  .collectSucc_top{
  color: #666666;
  font-size: 12px;
  }
  
  .collectSucc_top img{
  width: 60px;
  margin-top: 20px;
  }
  
  .collectSucc_buttom{
  margin-top: 20px;
  height: 40px;
  line-height: 40px;
  background-color: #2d99f5;
  color: #FFFFFF;
  font-size: 13px;
  }
 </script>
 
 </head>

 <body>
 <div class="tip">
 <!--收款成功-->
 <div class="collectSucc">
 <div class="collectSucc_top">
 <img src="../../img/tip.png" />
 <div>抢单失败,试试其他行程吧!</div>
 </div>
 <div class="collectSucc_buttom">
 我知道了
 </div>
 </div>
 </div>
 你好 我叫欧琪 啊哈哈 
 
 </body>

</html>

样式是这样的:

js+html5实现半透明遮罩层弹框效果

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持亿速云。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI