首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Tumblr如何为其导航栏链接创建如此平滑的悬停效果?没有JavaScript有可能吗?

Tumblr如何为其导航栏链接创建如此平滑的悬停效果?没有JavaScript有可能吗?
EN

Stack Overflow用户
提问于 2013-04-13 03:28:21
回答 1查看 1.5K关注 0票数 0

将鼠标悬停在Tumblr仪表板上的导航栏链接(例如,文本、照片、引用)上可创建平滑的效果,其中图标上升约5-10个像素,然后逐渐落回原处,就像有动画一样。

Tumblr仪表板:http://www.tumblr.com/dashboard

在我们的网站上使用普通的CSS来达到同样的效果(即位置:相对;顶部:-8px),当图标立即弹回原处时,会产生刺耳的效果。

有没有办法在没有JavaScript的情况下实现这种效果?

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-13 03:32:40

他们使用CSS3过渡效果演示http://jsfiddle.net/kevinPHPkevin/xejsM/500/

代码语言:javascript
复制
a {
    color:blue;
    /* First we need to help some browsers along for this to work.
     Just because a vendor prefix is there, doesn't mean it will
     work in a browser made by that vendor either, it's just for
     future-proofing purposes I guess. */
    -o-transition:color .2s ease-out, background 2s ease-in;
    -ms-transition:color .2s ease-out, background 2s ease-in;
    -moz-transition:color .2s ease-out, background 2s ease-in;
    -webkit-transition:color .2s ease-out, background 2s ease-in;
    /* ...and now for the proper property */
    transition:color .2s ease-out, background 2s ease-in;
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15979395

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档