Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Canvas View
css
.sketch-button { -webkit-tap-highlight-color: transparent; cursor: pointer; -webkit-appearance: none; -moz-appearance: none; appearance: none; outline: none; border: none; font-family: inherit; font-size: 16px; font-weight: 500; background-image: linear-gradient(90deg, #fcecfe, #fbf6e7, #e6fcf5); border-radius: 11px; padding: 12px 20px; position: relative; line-height: 24px; color: #14387e; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02), 0 4px 16px rgba(0, 0, 0, 0.02), 0 4px 24px rgba(0, 0, 0, 0.02); } .sketch-button.start svg { -webkit-animation: stroke 1s linear; animation: stroke 1s linear; } .sketch-button .lines { position: absolute; inset: 0; mix-blend-mode: hard-light; pointer-events: none; z-index: 1; } .sketch-button .lines > div { position: absolute; inset: 0; } .sketch-button .lines > div:last-child { transform: rotate(180deg); } .sketch-button .lines > div svg { display: block; position: absolute; inset: 0; overflow: visible; fill: none; stroke-width: 2; stroke: #c9e9ff; width: 100%; height: 100%; stroke-dasharray: 2 10; stroke-dashoffset: 14; opacity: 0; } .sketch-button .lines > div svg:nth-child(1) { stroke: #f8fcff; } .sketch-button .lines > div svg:nth-child(2) { stroke-width: 6px; filter: blur(20px); } .sketch-button .lines > div svg:nth-child(3) { stroke-width: 5px; filter: blur(6px); } .sketch-button .lines > div svg:nth-child(4) { stroke-width: 10px; filter: blur(56px); } @-webkit-keyframes stroke { 30%, 55% { opacity: 1; } 100% { stroke-dashoffset: 4; opacity: 0; } } @keyframes stroke { 30%, 55% { opacity: 1; } 100% { stroke-dashoffset: 4; opacity: 0; } } html { box-sizing: border-box; -webkit-font-smoothing: antialiased; } * { box-sizing: inherit; } *:before, *:after { box-sizing: inherit; } body { min-height: 100vh; display: flex; font-family: "Inter", Arial; justify-content: center; align-items: center; background: radial-gradient(circle at 50% 0%, #9588c7 15%, #c79ed5 75%); }
JavaScript
const createSVG = (width, height, radius) => { const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); const rectangle = document.createElementNS( "http://www.w3.org/2000/svg", "rect" ); svg.setAttributeNS( "http://www.w3.org/2000/svg", "viewBox", `0 0 ${width} ${height}` ); rectangle.setAttribute("x", "0"); rectangle.setAttribute("y", "0"); rectangle.setAttribute("width", "100%"); rectangle.setAttribute("height", "100%"); rectangle.setAttribute("rx", `${radius}`); rectangle.setAttribute("ry", `${radius}`); rectangle.setAttribute("pathLength", "10"); svg.appendChild(rectangle); return svg; }; document.querySelectorAll(".sketch-button").forEach((button) => { const style = getComputedStyle(button); const lines = document.createElement("div"); lines.classList.add("lines"); const groupTop = document.createElement("div"); const groupBottom = document.createElement("div"); const svg = createSVG( button.offsetWidth, button.offsetHeight, parseInt(style.borderRadius, 10) ); groupTop.appendChild(svg); groupTop.appendChild(svg.cloneNode(true)); groupTop.appendChild(svg.cloneNode(true)); groupTop.appendChild(svg.cloneNode(true)); groupBottom.appendChild(svg.cloneNode(true)); groupBottom.appendChild(svg.cloneNode(true)); groupBottom.appendChild(svg.cloneNode(true)); groupBottom.appendChild(svg.cloneNode(true)); lines.appendChild(groupTop); lines.appendChild(groupBottom); button.appendChild(lines); button.addEventListener("pointerenter", () => { button.classList.add("start"); }); svg.addEventListener("animationend", () => { button.classList.remove("start"); }); });
粒子
时间
文字
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号