【发布时间】:2014-09-07 00:07:52
【问题描述】:
我想在这个网站中创建一个悬停效果:
http://themes.creiden.com/circleflip/blog-with-sidebar/
只需将鼠标悬停在“更多”链接上即可。
http://joxi.ru/uXHGU_3JTJBkDpt35Iw
所以我尝试做这样的事情,但我只有这个变种
代码:
HTML
<a href="#">Click the link</a>
CSS
body{
padding: 100px;
background: #f6f6f6;
}
a{
display: block;
width: 200px;
position: relative;
background: #fff;
height: 40px;
font: 14px/40px Tahoma;
color: #39adf0;
text-decoration: none;
-webkit-transition: 0.2s;
margin: auto;
text-align: center;
position: relative;
}
a:after{
content: '';
position: absolute;
top: 0;
left: 0;
width: 0;
height: 1px;
background: #39adf0;
-webkit-transition: 0.2s;
-moz-transition: 0.2s;
-ms-transition: 0.2s;
-o-transition: 0.2s;
transition: 0.2s;
}
a:before{
content: '';
position: absolute;
top: 0;
right: 0;
width: 1px;
height: 0;
background: #39adf0;
-webkit-transition: 0.2s;
-moz-transition: 0.2s;
-ms-transition: 0.2s;
-o-transition: 0.2s;
transition: 0.2s;
}
a:hover:after{
width: 100%;
}
a:hover:before{
content: '';
position: absolute;
top: 0;
right: 0;
width: 1px;
height: 100%;
background: #39adf0;
-webkit-transition: 0.2s;
-moz-transition: 0.2s;
-ms-transition: 0.2s;
-o-transition: 0.2s;
transition: 0.2s;
}
但在示例中(在网站中),笔划按顺序出现在各个方面......我该怎么做?只有CSS3?也许用 jQuery?
【问题讨论】:
-
从动画的制作方式来看,应该是javascript。
-
哥们,这很简单,你可以从你提到的网站上获取所有的源代码。这有点挑剔,我不确定人们会帮助你“提升”别人的代码!基本上你在任何情况下都在错误的轨道上,因为你想要复制的效果由 4 个元素而不是 2 个元素组成。使用你的 web-inspectory/firebug 来调查并查看 CSS 中的“悬停”会发生什么
-
你试过检查元素吗?该链接中有 3 个跨度,一个带有文本,两个带有边框,它们会通过转换进行转换。它比你的尝试更复杂,但每个人都可以分析。
标签: jquery css css-transitions