首页 技术 正文
技术 2022年11月11日
0 收藏 648 点赞 4,546 浏览 1592 个字
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>水波纹按钮</title>
<link rel="stylesheet" href="css/bootstrap.min.css" rel="external nofollow" ><style>
/*自定义按钮样式*/
.btns{
height: 30px;
line-height: 30px;
text-align: center;
width: 200px;
color: #fff;
background-color: #428bca;
margin: 50px auto;
}/*必要样式*/
.water-btn{
position: relative;
overflow: hidden;
}
.wb-click{
position: absolute;
z-index: 2;
width: 100%;
height: 100%;
top:0px;
left: 0px;
}
.water-btn .wb-world{
position: relative;;
z-index: 1;
}
.water-btn .water-btn-style{
position:absolute;
border-radius:100%;
  opacity:.6;
background:#fff;
animation:waterBtn 3s;
-webkit-animation:waterBtn 3s; /* Safari and Chrome */
transform: translate(-50%, -50%) scale(1);
}@keyframes waterBtn
{
0% {
width:0px;
height:0px;
}
50% {
width:1000px;
height:1000px;
opacity:0
}
100%{
opacity:0
}
}@-webkit-keyframes waterBtn /* Safari and Chrome */
{
0% {
width:0px;
height:0px;
}
50% {
width:1000px;
height:1000px;
opacity:0
}
100%{
opacity:0
}
}
</style>
</head>
<body>
<!-- domo data-clickColor是水波纹的颜色;可以是#xxxxxx的形式,也可以是rgba()的形式 -->
<div class="water-btn btns" data-clickColor="rgba(255,255,255,.5)">
<div class="wb-click"></div>
<div class="wb-world">这里是一个按钮</div>
</div><script src="js/jquery.min.js"></script>
<script>
$(function(){
$('.water-btn').click(function(e){
var _this = $(this);
var px = e.offsetX;
var py = e.offsetY; var id=parseInt(Math.random()*1000);
_this.append('<div class="water-btn-style" style="top:'+py+'px;left:'+px+'px;background:'+_this.attr('data-clickColor')+'" id="wb_'+id+'"></div>');
setTimeout(function(){
_this.find('#wb_'+id).remove()
},3000)
});
});
</script>
</body>
</html>
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,499
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,913
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,746
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,503
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,142
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,305