Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Cool CSS hover effect
Coffee
A color styled icon from Orion Library.
Glazed Donut
A color styled icon from Orion Library.
Pizza Slice
A color styled icon from Orion Library.
Smile Emoji
A color styled icon from Orion Library.
Taxi
A color styled icon from Orion Library.
css
/* --------------------------------------------------------- Only this CSS is required for this effect to work This is pure CSS, using SCSS only for other page styles --------------------------------------------------------- */ .applyEffect { transition: fill var(--transition-duration); fill: transparent; } svg:hover .applyEffect, svg:focus .applyEffect { fill: var(--hover-color); } /* --------------------------------------------------------- Other page styles, nothing to do with the effect --------------------------------------------------------- */ :root { --body-background-color: #2e4369; --transition-duration: .13s; --box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.3); --font-stack: Helvetica Neue, Helvetica, Arial, sans-serif; } body, html { background: var(--body-background-color); font-family: var(--font-stack); text-align: center; } body { padding: 0 12px; } * { box-sizing: border-box; } a { color: inherit; text-decoration: none; font-weight: bold; } a:hover { text-decoration: underline; } main { background: #fefefe; padding: 16px 8px; margin: 56px auto; max-width: 720px; border-radius: 12px; box-shadow: var(--box-shadow); } main .isSupported { display: none; } main .notSupported { display: block; background: rgba(255, 0, 0, 0.13); padding: 8px 16px; border-radius: 8px; } @supports (--a: 0) { main .isSupported { display: block; } main .notSupported { display: none; } } main h1 { margin: 0 0 8px 0; font-weight: 100; } main p { max-width: 512px; margin: 0 auto 16px; } main svg { height: 112px; margin: 8px; } h2 { color: rgba(255, 255, 255, 0.57); font-size: 18px; font-weight: 100; } h2 svg { height: 20px; position: relative; bottom: -2px; } h2 svg path { stroke: rgba(255, 255, 255, 0.57); } h2 svg:hover .applyEffect { fill: var(--hover-color); } h2 svg:hover path { stroke: #000; }
JavaScript
/* Gets all elements with class 'applyEffect' and copies fill into CSS3 custom property. A less convenient, but non-javascript, option is to do this by hand like this:
*/ document.querySelectorAll('.applyEffect').forEach(function(element) { const hoverColor = element.getAttribute("fill"); // get the fill color // set it as a custom property inline if (hoverColor) element.style.setProperty('--hover-color', hoverColor); });
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title> CSS悬停效果-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号