web299.com
全部
教育
语言/资格考试
法律
互联网
政务民生
Word模板
Excel模板
PPT模板
网页特效
小程序模板
网站模板
首页
教育
语言/资格考试
法律
互联网
政务民生
Word模板
Excel模板
PPT模板
网页特效
小程序模板
网站模板
当前位置:
首页
>
网页特效
>
按钮特效
jQuery和CSS3炫酷按钮点击波特效
分类:
按钮特效
日期:
2024-05-14
点击(4)
评论(0)
演 示
免费下载
简介
这是一款效果非常炫酷的jQuery和CSS3炫酷按钮点击波特效。该特效当用户在菜单按钮上点击的时候,从鼠标点击的点开始,会有一道光波以改点为原点向外辐射的动画效果,非常绚丽。 ##### 使用方法 ###### HTML结构 该例中的点击波按钮使用的是一个无序列表。 ```html
Dashboard
My Account
Direct Messages
Chat Rooms
Settings
Logout
``` ##### CSS样式 首先作为按钮使用的
元素和它的父元素li都设置为相对定位方式。为了使后面的光波效果不至于扩散到按钮之外,设置li元素的overflow:hidden;。 ```html ul { background: white; border-top: 6px solid hsl(180, 40%, 60%); width: 200px; margin: 5em auto; } ul li { list-style-type: none; position: relative; overflow: hidden; } ul li a { font: normal 14px/28px Montserrat; color: hsl(180, 40%, 40%); display: block; padding: 10px 15px; text-decoration: none; cursor: pointer; /*since the links are dummy without href values*/ /*prevent text selection*/ user-select: none; position: relative; } ``` .ink是点击波特效的主要样式,它是通过js动态生成的
元素,它的位置和大小有js代码决定。开始时,.ink元素的尺寸被设置为0,然后在用户点击时被放大。 ```html /*.ink styles - the elements which will create the ripple effect. The size and position of these elements will be set by the JS code. Initially these elements will be scaled down to 0% and later animated to large fading circles on user click.*/ .ink { display: block; position: absolute; background: hsl(180, 40%, 80%); border-radius: 100%; transform: scale(0); } /*animation effect*/ .ink.animate {animation: ripple 0.65s linear;} @keyframes ripple { /*scale the element to 250% to safely cover the entire link and fade it out*/ 100% {opacity: 0; transform: scale(2.5);} } ``` ##### JAVASCRIPT 该点击波特效的js代码使用jQuery来实现。当列表中的
元素被点击的时候,插件会查找它的父元素li中是否有.ink的元素,如果没有则创建一个。然后设置.ink元素的尺寸大小和坐标,最后为它添加.animate class,使其产生点击波的动画效果。 ```html ```
相关推荐
html5浪漫粒子表白文字特效
SlidesJS幻灯片特效
html5瀑布流相册特效
css3 svg实现的情人节表白鲜花动画特效
t-scroll.js基于ES6的DOM元素,过渡动画库插件
纯js写省市区三级联动效果
广告
广告