css3实战版的点击列表项产生水波纹动画
1、html+js:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<link rel="stylesheet" href="./css/reset.css"/>
<link rel="stylesheet" href="./css/animation.css"/>
<script type="text/javascript" src="./js/jquery-1.10.2.min.js"></script>
<title>animation-css3动画</title>
</head>
<body>
<ul class="clear">
<li><span class="circle"></span><a href="#">Button</a></li>
<li><span class="circle"></span><a href="#">Elements</a></li>
<li><span class="circle"></span><a href="#">Forms</a></li>
<li><span class="circle"></span><a href="#">Charts</a></li>
</ul>
</body>
<script type="text/javascript">
;(function(){
var items = document.getElementsByTagName('li');
for(var i = 0; i < items.length; i++){
items[i].onclick = function(){
// alert($(this));
this.getElementsByTagName('span')[0].style.animation = 'circle-opacity 0.5s linear 0s 1';
this.getElementsByTagName('span')[0].style.webkitAnimation = 'circle-opacity 0.5s linear 0s 1';
this.getElementsByTagName('span')[0].style.animationFillMode = 'forwards';
$(this).siblings().children('a').css('color','#333');
$(this).children('a').css('color',' #2196f3');
clearAnimation(this);
//alert(this.getElementsByTagName('span')[0].getAttribute('class'));//弹出circle证明获取到了子元素span
}
}
function clearAnimation(self){
var sid = window.setInterval(function(){
self.getElementsByTagName('span')[0].style.animation = '';
self.getElementsByTagName('span')[0].style.webkitAnimation = '';
self.getElementsByTagName('span')[0].style.animationFillMode = '';
sid = window.clearInterval(sid);
},500);
}
})(window);
</script>
</html>
2、css:
ul{width: 300px;border: red;}
ul li{width: 300px;height: 70px;line-height: 70px;background: #fff;text-align: center;cursor: pointer;overflow: hidden;}
ul li a{font-weight: 900;}
ul li:hover a{
color: #2196f3!important;
/*animation: circle-opacity 0.5s linear 0s 1;*/
/*-webkit-animation-fill-mode:forwards;让动画停在最后是这个属性,*/
/*animation-fill-mode:forwards;*/
}
ul li a{position: relative;left: -50px;color: #333;top: -30px;}
.circle{background: transparent;border-radius: 50%;width: 70px;height: 70px;display: inline-block;margin: 0 auto;}
@keyframes circle-opacity{
0% {
background: rgba(192,225,250,0);
}
50% {
transform:scale(4);
background: rgba(192,225,250,1);
}
100% {
transform:scale(16);
background: rgba(192,225,250,0);
}
}
@-webkit-keyframes circle-opacity{
0% {
background: rgba(192,225,250,0);
}
50% {
transform:scale(4);
background: rgba(192,225,250,1);
}
100% {
transform:scale(16);
background: rgba(192,225,250,0);
}
}
css3实战版的点击列表项产生水波纹动画的更多相关文章
- css3实战版的点击列表项产生水波纹动画——之jsoop面向对象封装版
1.html: <!DOCTYPE html><html><head lang="en"> <meta charset=" ...
- 自定义ListView适配器Adapter引用布局文件的情况下实现点击列表项时背景颜色为灰色
listview控件设置适配器的时候,如果使用自定义的adapter,比如MyArrayAdapter extends ArrayAdapter<String> 如果listitem布局文 ...
- Flutter 实战(一):列表项内容可自定义的列表组件
前言 本篇文的目的是熟练掌握 Flutter 组件的封装,并且使用回调函数实现主要功能. 本组件的设计灵感来源于 Element 组件库的 table 组件. 正题 定义回调函数 在此之前,必须要了解 ...
- ListView控件的列表项的文字不满一行的时候,如何实现点击该列表项的空白区域仍可触发列表项的点击事件
今天在做Demo的过程中,使用到了ListView.然而在实现过程中,发现一个出现了一个问题:只能点击列表项的文字区域可以触发点击事件,而点击列表项的空白区域无法触发点击事件. 如下图: listit ...
- Android学习笔记(23):列表项的容器—AdapterView的子类们
AdapterView的子类的子类ListView.GridView.Spinner.Gallery.AdapterViewFlipper和StackView都是作为容器使用,Adapter负责提供各 ...
- Android之水波纹点击效果(RippleView)
Android5.0后各种炫的效果纷纷出来,写这篇博客主要是讲的是按钮点击效果带有的水波纹(波浪式). 当然我写的这个是自定义来实现的,在低版本(5.0一下)也可以实现点击效果.看看效果图: 上图可看 ...
- android: Android水波纹点击效果
Android API 21及以上新增了ripple标签用来实现水波纹的效果.我们可以通过设置ripple背景来实现一些View点击效果. 该水波纹效果有两种:一种是有界的(点击后类似于一个矩形向四周 ...
- Android点击列表后弹出输入框,所点击项自动滚动到输入框上方
使用微信的朋友圈会发现,点击某一条评论后输入框会弹出来,然后所点击的那一项会自动地滚动到输入框上方的位置,这样如果开始所点击的评论在屏幕很下方的话,就不会被输入框遮住,虽然微信这一点在我的MX2频繁点 ...
- CSS3实战手册(第3版)(影印版)
<CSS3实战手册(第3版)(影印版)> 基本信息 原书名:CSS3: The Missing Manual, 3E 作者: David Sawyer McFarland 出版社:东南大学 ...
随机推荐
- sql语句删除由于无主键导致完全重复的数据方法
sql语句删除由于无主键导致完全重复的数据方法 select distinct * into #Tmp from t_column drop table t_column select * into ...
- 苹果充电器USB端的识别电阻的设置
苹果为充电器定义了3种充电电流,分别是0.5A/1A/2.1A.具体是由3种不同的电阻组合来实现的.当苹果的设备ipad,iphone,ipod接入USB口充电器时,会先检测USB D+和D-上的电压 ...
- 转 sqlplus执行sql报错:ORA-01756:
1.sqlplus执行sql报错:ORA-01756: quoted string not properly terminated 分类: 技术 在SQLPLUS中执行SQL文件时 ...
- Counting Islands II
Counting Islands II 描述 Country H is going to carry out a huge artificial islands project. The projec ...
- IOS 9人机界面指南(1)
http://www.uisdc.com/ios9-interface-guideline-ui
- memory runs at single channel问题解决
memory runs at single channel 解决方案:开机后按DEL ,然后进入BIOS 选择第一项,回车! advanced下面的有个momori什么什么的,选择disable. m ...
- python赋值和拷贝----一切皆对象,参数皆引用
摘要: 1 python中的一切事物皆为对象,并且规定参数的传递都是对象的引用. 2 python参数传递都是"传对象引用"方式.实际上相当于c++中传值和传引用的结合. 3 如 ...
- ural1613 For Fans of Statistics
For Fans of Statistics Time limit: 1.0 secondMemory limit: 64 MB Have you ever thought about how man ...
- PAT (Advanced Level) 1007. Maximum Subsequence Sum (25)
简单DP. 注意:If all the K numbers are negative, then its maximum sum is defined to be 0, and you are sup ...
- mysql管理 ------查看 MySQL 数据库中每个表占用的空间大小
如果想知道MySQL数据库中每个表占用的空间.表记录的行数的话,可以打开MySQL的 information_schema 数据库.在该库中有一个 TABLES 表,这个表主要字段分别是: TABLE ...