Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Lettering.js Button Hover States
Submit
Share this page
Looking good, Billy Ray!
Feeling good, Louis!
Now go backwards
css
@import url("https://fonts.googleapis.com/css?family=Lato:400,700"); body { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; padding: 0.75em; min-height: 100vh; } main { display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; } h1 { margin-bottom: 1.5em; font-family: "Lato", Arial, sans-serif; font-size: 1.875em; line-height: 1.2; font-weight: 700; } .btn { display: inline-block; position: relative; cursor: pointer; overflow: hidden; margin: 0.375em; padding: 0.75em 1.5em; font-size: 1.125em; font-family: "Lato", Arial, sans-serif; text-transform: uppercase; letter-spacing: 0.00313em; border: none; border-radius: 0.125em; -webkit-transition: background-color 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), border-color 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), box-shadow 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), -webkit-transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1); transition: background-color 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), border-color 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), box-shadow 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), -webkit-transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1); transition: background-color 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), border-color 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), box-shadow 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1); transition: background-color 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), border-color 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), box-shadow 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), -webkit-transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1); } .btn:before { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 100%; z-index: 1; -webkit-transform: translateY(100%); transform: translateY(100%); -webkit-transition: -webkit-transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1); transition: -webkit-transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1); transition: transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1); transition: transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), -webkit-transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1); } .btn:hover, .btn:focus { -webkit-transform: translateY(-4px); transform: translateY(-4px); box-shadow: rgba(0, 0, 0, 0.4) 0 0.375em 1.5em -0.375em; } .btn:hover:before, .btn:focus:before { -webkit-transform: translateY(0); transform: translateY(0); } .btn:active { -webkit-transform: translateY(-3px); transform: translateY(-3px); -webkit-transition: -webkit-transform 0s; transition: -webkit-transform 0s; transition: transform 0s; transition: transform 0s, -webkit-transform 0s; } .btn--action [class^="word"] { display: inline-block; } .btn--action [class^="char"] { display: inline-block; position: relative; overflow: hidden; z-index: 2; } .btn--action [class^="char"].letter-space { width: 0.25em; } .btn--action [class^="char"] span { display: inline-block; } .btn--action [class^="char"] span:before { content: attr(data-letter); display: block; position: absolute; top: 110%; z-index: 3; } .btn--one { color: black; background-color: lightblue; } .btn--one:before { background-color: #86c5da; background: -webkit-linear-gradient(bottom, #86c5da, transparent); background: linear-gradient(to top, #86c5da, transparent); } .btn--one:hover, .btn--one:focus { outline-color: lightblue; } .btn--one span:before { color: white; } .btn--two { color: black; background-color: darkseagreen; } .btn--two:before { background-color: #6fa96f; background: -webkit-linear-gradient(bottom, #6fa96f, transparent); background: linear-gradient(to top, #6fa96f, transparent); } .btn--two:hover, .btn--two:focus { outline-color: darkseagreen; } .btn--two span:before { color: white; } .btn--three { color: white; background-color: crimson; } .btn--three:before { background-color: #ed365b; background: -webkit-linear-gradient(bottom, #ed365b, transparent); background: linear-gradient(to top, #ed365b, transparent); } .btn--three:hover, .btn--three:focus { outline-color: crimson; } .btn--three span:before { color: black; } .btn--four { color: white; background-color: lightslategray; } .btn--four:before { background-color: #94a2af; background: -webkit-linear-gradient(bottom, #94a2af, transparent); background: linear-gradient(to top, #94a2af, transparent); } .btn--four:hover, .btn--four:focus { outline-color: lightslategray; } .btn--four span:before { color: black; } .btn--five { color: black; background-color: tan; } .btn--five:before { background-color: #c49c67; background: -webkit-linear-gradient(bottom, #c49c67, transparent); background: linear-gradient(to top, #c49c67, transparent); } .btn--five:hover, .btn--five:focus { outline-color: tan; } .btn--five span:before { color: white; }
JavaScript
var $body = $('body'); var $btnAction = $('.btn--action'); var innerWrapClass = 'inner-wrap'; var $letter, $letterWrapper, $innerWrapper; // Wrap words $btnAction.lettering('words'); // Wrap letters $('[class^="word"]').lettering(); $letter = $btnAction.find('[class^="char"]'); // Wrap inner to hide overflow on each letter $letter.each(function() { $(this).wrapInner('
'); $letterWrapper = $(this).find('span'); $letterWrapper .addClass(innerWrapClass) .attr('data-letter', $(this).text()); // Add class to text spaces if ($letterWrapper.data('letter') === ' ') { $(this).addClass('letter-space'); } }); // Setup animation $btnAction.each(function(index, el) { var tl, duration, stagger, anim; $innerWrapper = $(el).find('.' + innerWrapClass); tl = new TimelineMax({paused: true}); duration = $(el).attr('data-duration') ? $(el).data('duration') : 0.3; stagger = $(el).attr('data-stagger') ? $(el).data('stagger') : 0.03; anim = tl.staggerTo($innerWrapper, duration, { y: '-110%', ease: Back.easeOut }, stagger); el.animation = anim; // Apply animation to hover and focus states $(el).on("mouseenter focusin", function() { this.animation.play(); }).on("mouseleave focusout", function() { this.animation.reverse(); }); });
粒子
时间
文字
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号