css 点击打开遮罩

<div>
  <nav class="bar bar-tab">
    <a class="tab-item external" href="#">
      <div class="tab-flex">
        <img src="/src/assets/images/massage.png">
        <span class="tab-label" id="share">分享</span>
      </div>
    </a>
    <a class="tab-item external tab-mar" href="#">
      <div class="m-nav-span"><span class="tab-label">参会报名</span></div>
    </a>
    <a class="tab-item external tab-mar" href="#">
      <div class="m-nav-span"><span class="tab-label">参会报名</span></div>
    </a>
<!--    <a class="tab-item external tab-mar" href="#">-->
<!--      <div class="m-nav-span"><span class="tab-label">参会报名</span></div>-->
<!--    </a>-->
  </nav>
</div>
<!-- 底部透明灰色层 -->
<div class='mask'></div>

<!-- 二维码层 -->
<div class='board'>
   <div class="board-flex">
     <div class="share-content-m">
       <img src="/src/assets/images/weixin.png" alt="微信" class="share-image">
       <span class="share-m-span">微信</span>
     </div>
     <div class="share-content-m">
       <img src="/src/assets/images/qq.png" alt="qq" class="share-image">
       <span class="share-m-span">QQ</span>
     </div>
     <div class="share-content-m">
       <img src="/src/assets/images/weibo.png" alt="微博" class="share-image">
       <span class="share-m-span">微博</span>
     </div>
   </div>
   <div class="board-footer">
     <span class="cancel">取消</span>
   </div>
</div>
<script>
  $("#share").click(function(){
    $('.mask').css('display','block');
    $('.board').css('display','block');
  });
  $('.cancel').click(function(){
    $('.mask').css('display','none');
    $('.board').css('display','none');
  });
</script>
<style>
  /* 透明灰色层 */
  .mask {
    position: fixed; top: 0; left: 0; z-index: 998;
    width: 100%; height: 100%; display: none;
    background-color: rgba(0,0,0,1); opacity: 0.51; overflow: hidden;
  }
  /* 分享类型 */
  .board {
    position: fixed;
    background:rgba(254,254,254,1);
    bottom: 0%;
    left: 0%;
    width: 100%;
    height: 8.1rem;
    z-index: 999;
    display: none;
  }
  .board-flex {
     height: 5.05rem;
     width: 100%;
     display: flex;
     flex-direction: row;
     justify-content: space-around;
     line-height: 5.05rem;
  }
  .cancel {
    width:32px;
    height:22px;
    font-size:16px;
    font-family:PingFangSCMedium;
    color:rgba(51,51,51,1);
    line-height:22px;
  }
  .board-footer {
     height: 3rem;
     line-height: 3rem;
     text-align: center;
  }
  .share-content-m {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .share-m-span {
    width:1.3rem;
    height:1.17rem;
    font-size:0.6rem;
    font-family:PingFangTC-Medium,PingFangTC;
    font-weight:bold;
    color:rgba(102,102,102,1);
    line-height:1.17rem;
    letter-spacing:1px;
    text-align: center;
  }
</style>

效果:

 

 

posted @ 2019-12-17 11:18  1点  阅读(317)  评论(0编辑  收藏  举报