首页 建站教程 WEB前端 正文

用SVG给页面按钮添加个性点击效果

首先,GitHub的右上方的“Download Zip”zip文件下载。然后将zip文件解压,将解压后js文件夹中的「TweenMax.min.js」和「main.js」加在网页的</body>前面并加载按钮样式表main.css; <script src="js/TweenMax.min....

用SVG给页面按钮添加个性点击效果 前端 按钮特效 GitHub 图1

首先,GitHub的右上方的“Download Zip”zip文件下载。然后将zip文件解压,将解压后js文件夹中的「TweenMax.min.js」和「main.js」加在网页的</body>前面并加载按钮样式表main.css

<script src="js/TweenMax.min.js"></script>
<script src="js/main.js"></script>
<link href="CSS/main.css"/ rel="stylesheet">

html代码示例:

<button id="component-1" class="button button--1">
    点击按钮
    <span class="button__container">
        <span class="circle top-left"></span>
        <span class="circle top-left"></span>
        <span class="circle top-left"></span>
        <span class="button__bg"></span>
        <span class="circle bottom-right"></span>
        <span class="circle bottom-right"></span>
        <span class="circle bottom-right"></span>
    </span>
</button>

将SVG代码添加在页面的body标签中,位置没有限制:

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="svg-filters">
   <defs>
     <filter id="filter-goo-1">
       <feGaussianBlur in="SourceGraphic" stdDeviation="7" result="blur" />
        <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19 -9"
         result="goo" />
        <feComposite in="SourceGraphic" in2="goo" />
     </filter>
   </defs>
</svg>

从GitHub中下载的代码中还有更多的按钮点击效果,具体的使用方法可以参考文件中的demo。

官方演示:Distorted Button Effects - Codrops

GitHub:GitHub – codrops/DistortedButtonEffects

打赏
海报

本文由优美主题原创或收集发布

转载请注明本文地址:https://www.umtheme.com/web/17.html

相关推荐

css中position:fixed如何实现相对于父级定位

css中position:fixed如何实现相对于父级定位

在项目开发中我们经常会用到position:fixed属性,它常常应用的场合是,当下拉滚动条时固定导航栏到顶部,将广告固定在页面两侧或浏览器中间。当我们使用position:fixed定位属性时,它生...
WEB前端 2023.02.12 0 207
纯css实现菜单或列表循环向上滚动效果

纯css实现菜单或列表循环向上滚动效果

在前端开发过程中,有时候针对某个模块需要无限循环的滚动一些消息或菜单,我们常用的方法基本上都是通过js来实现,虽然代码相对来说可能会精简一些,但是对于JS不是很熟悉的同学来说还是不太好理解,毕竟相对于...
WEB前端 2022.08.17 0 856
纯CSS实现侧边栏浮动在线客服效果

纯CSS实现侧边栏浮动在线客服效果

很多人一般在网页的侧边会选择放一个悬浮的在线客服,方便意向客户的联系,网上随便一搜也会有很多代码提供,但是大多都是JS书写的,并且夹带着...
WEB前端 2022.08.17 0 434
发布评论

ainiaobaibaibaibaobaobeishangbishibizuichiguachijingchongjingdahaqiandaliandangaodw_dogedw_erhadw_miaodw_tuzidw_xiongmaodw_zhutouganbeigeiliguiguolaiguzhanghahahahashoushihaixiuhanheixianhenghorse2huaixiaohuatonghuaxinhufenjiayoujiyankeaikeliankouzhaokukuloukunkuxiaolandelinileimuliwulxhainiolxhlikelxhqiuguanzhulxhtouxiaolxhwahahalxhzanningwennonuokpinganqianqiaoqinqinquantouruoshayanshengbingshiwangshuaishuijiaosikaostar0star2star3taikaixintanshoutianpingtouxiaotuwabiweifengweiquweiwuweixiaowenhaowoshouwuxiangjixianhuaxiaoerbuyuxiaokuxiaoxinxinxinxinsuixixixuyeyinxianyinyueyouhenghengyuebingyueliangyunzanzhajizhongguozanzhoumazhuakuangzuohenghengzuoyi
感谢您的支持