css遮罩效果

今天,简单了解,css做的简单遮罩效果,具体如下图

下边是它的html结构

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>鼠标悬停遮罩</title>

<script src="./jquery-3.3.1.min.js"></script>

<style>
::-moz-selection {
    color: #FFF;
    background: none;
}

::selection {
    color: #FFF;
    background: none;
}

html {
  height: 100%;
}

body {
  height: 100%;
  font-family: 'Montserrat', sans-serif;
  text-align: center;
  background: url("./xiaobai.jpg") no-repeat left top;
  background-size: cover;
  overflow: hidden;
}

.hole {
  margin: -150px 0 0 -150px;
  width: 300px;
  height: 300px;
/*    9999em可选的阴影大小*/
  box-shadow: 0 0 0 9999em #000; 
  border-radius: 50%;
  cursor: pointer;
  position: fixed;
  transition: width .5s ease-in-out, height .5s ease-in-out, margin .5s ease-in-out;
}

.hole:after {
  content: "";
  display: block;
  margin: -1% 0 0 -1%;
  width: 102%;
  height: 102%;
  box-shadow: inset 0 0 50px 50px #000;
  border-radius: 50%;
}
/*:active向活动的链接添加特殊的样式。*/
.hole:active {
  margin: -250px 0 0 -250px;
  width: 500px;
  height: 500px;
  transition: width 1s ease-in-out, height 1s ease-in-out, margin 1s ease-in-out;
}



</style>
</head>
<body>

<div class="hole"></div>



<script>
$(document).on("mousemove", function(event) {
  $(".hole").css({
    "top": event.pageY,
    "left": event.pageX
  });
});</script>

</body>
</html>

如果有需要做网页的,请加我q1471503422哦

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值