Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Hover / Click / Hold
css
@import url("https://fonts.googleapis.com/css?family=Montserrat&display=swap"); html, body { margin: 0px; background: #000; } .cbtn-wrap { overflow: hidden; text-align: center; margin-top: 50px; } #cbtn-title { position: relative; font-family: Montserrat; color: #fff; font-size: 24px; text-transform: uppercase; font-weight: 600; text-decoration: underline; } .cbtn-o { display: inline-block; position: relative; } .cbtn-o > .cbtn-i { position: relative; z-index: 3; cursor: pointer; margin: 40px 20px; padding: 10px 25px; border-radius: 100px; font-family: Montserrat; font-weight: 600; color: #fff; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); transition: 250ms cubic-bezier(0, 0.5, 0.5, 1); -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .cbtn-o > .cbtn-i[data-mode="0"] { background: #e96651; box-shadow: 0px 0px 0px #e96651; } .cbtn-o > .cbtn-i[data-mode="0"]:hover { transform: scale(0.9); background: #efaf60; box-shadow: 0px 0px 30px #efaf60; } .cbtn-o > .cbtn-i[data-mode="0"]:active { transform: scale(1); } .cbtn-o > .cbtn-i[data-mode="1"] { background: #3770a0; box-shadow: 0px 0px 0px #3770a0; } .cbtn-o > .cbtn-i[data-mode="1"]:hover { transform: scale(0.9); background: #77b6ea; box-shadow: 0px 0px 20px #77b6ea; } .cbtn-o > .cbtn-i[data-mode="1"]:active { transform: scale(0.6); } .cbtn-o > .cbtn-i[data-mode="2"] { background: #30a254; box-shadow: 0px 0px 0px #30a254; transition: 350ms cubic-bezier(0, 0.5, 0.5, 1); } .cbtn-o > .cbtn-i[data-mode="2"]:hover { transform: scale(0.9); background: #51e980; box-shadow: 0px 0px 30px #51e980; } .cbtn-o > .cbtn-i[data-mode="2"]:active { transform: scale(0.9) rotateX(-360deg); } .cbtn-o > .cbtn-i[data-mode="3"] { background: #8e54ff; box-shadow: 0px 0px 0px #8e54ff; } .cbtn-o > .cbtn-i[data-mode="3"]:hover { transform: scale(0.9); background: #a93ee0; box-shadow: 0px 0px 30px #a93ee0; } .cbtn-o > .cbtn-i[data-mode="3"]:active { transform: scale(0.9) rotate(-360deg); } .cbtn-o > .cbtn-i[data-mode="4"] { background: #ff0000; box-shadow: 0px 0px 0px #ff0000; } .cbtn-o > .cbtn-i[data-mode="4"]:hover { transform: scale(0.9); background: #ff0000; box-shadow: 0px 0px 30px #ff0000; } .cbtn-o > .cbtn-i[data-mode="4"]:active { transition: none; filter: blur(7px); color: transparent; } .cbtn-o > canvas { position: absolute; z-index: 2; top: 0px; left: 0px; } .cbtn-nav { color: #fff; display: inline-block; position: relative; z-index: 1; font-size: 18px; padding: 10px; cursor: pointer; text-shadow: 2px 2px 4px #111; } .cbtn-nav#nav-next { margin-left: 20px; } .cbtn-nav#nav-next::before { left: 15px; } .cbtn-nav#nav-prev { margin-right: 20px; } .cbtn-nav#nav-prev::before { left: 17px; } .cbtn-nav:hover::before { width: 40px; height: 40px; } .cbtn-nav::before { content: ""; position: absolute; border-radius: 100px; top: 20px; transform: translate(-50%, -50%); height: 0px; width: 0px; background: #333333; z-index: -1; transition: 150ms ease-in-out; } .next_anim { animation: next 600ms ease; pointer-events: none; } .prev_anim { animation: prev 600ms ease; pointer-events: none; } .info-wrap { font-family: Montserrat; } .info-wrap > .info-text { display: inline-block; color: #333333; width: 30%; max-width: 300px; padding: 15px; background: #ccc; border-radius: 100px; font-size: 14px; font-weight: 600; } @keyframes next { 0% { left: 0px; opacity: 1; } 50% { left: 300px; opacity: 0; } 50.1% { left: -300px; opacity: 0; } 100% { left: 0px; opacity: 1; } } @keyframes prev { 0% { left: 0px; opacity: 1; } 50% { left: -300px; opacity: 0; } 50.1% { left: 300px; opacity: 0; } 100% { left: 0px; opacity: 1; } } .social { position: absolute; bottom: 20px; left: 30px; } .social .icon { display: inline-block; } .social .icon:hover img { transform: scale(0.8); } .social .icon img { display: inline-block; height: 40px; width: 40px; position: relative; transition: 150ms cubic-bezier(0, 0.5, 0.5, 1); } .social .icon::before { content: ""; position: absolute; border-radius: 100px; top: 20px; left: 20px; transform: translate(-50%, -50%); height: 0px; width: 0px; background: #333; z-index: -1; transition: 150ms cubic-bezier(0, 0.5, 0.5, 1); } .social .icon:hover::before { height: 50px; width: 50px; }
JavaScript
window.onload = function(){ var canvas = document.createElement("canvas"); var innerBtn = document.querySelector("#cbtn1 .cbtn-i"); var outerBtn = document.getElementById("cbtn1"); var nextBtn = document.getElementById("nav-next"); var prevBtn = document.getElementById("nav-prev"); var btnTitle = document.getElementById("cbtn-title"); var tipText = document.querySelector(".info-wrap .info-text"); outerBtn.appendChild(canvas); var ctx = canvas.getContext("2d"); w = ctx.canvas.width = outerBtn.offsetWidth; h = ctx.canvas.height = outerBtn.offsetHeight; dots=[]; hoverFlag = false; clickFlag = false; mode = 0; nt = 0; tip = 0; tips = [ "Stepping up your hover effects game!", "The spacing/canvas area around the button can be easily adjusted via CSS margin.", "Tested in IE and on various mobile devices.", "No libraries required!", "Imagine the endless possibilities :)", "In this case there is only one Button which is being controlled via JS.", "Using a black background for the best contrast.", "More effects coming soon..." ]; modeSets = [ { name: "Fireflies", maxDots: 75, maxSpeed: 3, minSpeed: 1, emitRate: 10, emitNum: 2, radius: 2, trail: 0.2, maxTime: 1500, minTime: 750, glow: 10, hueMin: 15, hueMax: 55 }, { name: "Hyper Jump", maxDots: 100, maxSpeed: 3, minSpeed: 1, emitRate: 10, emitNum: 3, radius: 1.75, trail: 0.06, maxTime: 700, minTime: 300, glow: 7, hueMin: 170, hueMax: 230 }, { name: "Focus", maxDots: 75, maxSpeed: 2, minSpeed: 0.5, emitRate: 10, emitNum: 2, radius: 7, trail: 1, maxTime: 1000, minTime: 500, glow: 0, hueMin: 60, hueMax: 130 }, { name: "Vortex", maxDots: 150, maxSpeed: 2, minSpeed: -2, emitRate: 20, emitNum: 5, radius: 7, trail: 1, maxTime: 3000, minTime: 1500, glow: 0, hueMin: 260, hueMax: 330 } , { name: "Code Red", maxDots: 50, maxSpeed: 1, minSpeed: 0.3, emitRate: 20, emitNum: 1, radius: 1.7, trail: 1, maxTime: 3000, minTime: 1500, glow: 10, hueMin: 0, hueMax: 10 } ] function emitDots(x,y){ if(dots.length
w || dots[i].x<0 || dots[i].y>h || dots[i].y<0 || dots[i].st+dots[i].lt
mode-1){ mode = modeSets.length-1; }else{ mode -= 1; } setTimeout(function(){ innerBtn.setAttribute("data-mode", mode); btnTitle.innerHTML = modeSets[mode].name; }, 300); outerBtn.classList.add("prev_anim"); btnTitle.classList.add("next_anim"); setTimeout(function(){ outerBtn.classList.remove("prev_anim"); btnTitle.classList.remove("next_anim"); }, 600) } tipText.innerHTML = tips[tip]; setInterval(function(){ tips.length<=tip+1?tip=0:tip+=1; tipText.innerHTML = tips[tip]; }, 7000) }
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>多种按钮点击动画效果-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号