【发布时间】:2018-04-20 03:05:26
【问题描述】:
我正在尝试复制在 this web page 上看到的悬停时显示的描述
通过练习这个例子我有点接近了:
@import url(https://fonts.googleapis.com/css?family=Ubuntu);
a.box {
color: #fff;
background-color: #2f9b9b;
display: block;
width: 400px;
height: 250px;
overflow: hidden;
position: relative;
cursor: pointer;
font-family: 'Ubuntu', sans-serif;
}
.content {
position: absolute;
bottom: 0;
right: 0;
top: 0;
margin: auto;
padding: 0 4em;
z-index: 2;
height: 3em;
transition: all .2s ease;
}
a:hover .content {
height: 8em;
transition: all .2s ease;
}
h2 {
font-size: 2em;
font-weight: normal;
margin: 0 0 5px 0;
}
p {
height: 0;
opacity: 0;
visibility: hidden;
margin: 5px;
line-height: 1.5em;
}
a:hover p{
height: 3em;
opacity: 1;
visibility: visible;
transition: all .2s ease;
}
.link {
height: 1.5em;
line-height: 1.5;
transition: all .2s ease;
display: block;
font-size: 0.85em;
font-style: italic;
}
a:hover .link {
transition: all .2s ease;
}
.description {
text-align: center;
}
<a class="box">
<div class="content">
<h2>
DONALD JUDGES
</h2>
Vice Provost for Distance Education
<p class="description">
<br/>
GLBL 505
<br/>
479-575-7571
<br/>
djudges@uark.edu
<span class="link">Click to read more >> </span>
</p>
</div>
</a>
对我来说最困难的部分是当鼠标悬停在某人的图片上时,他们如何使带有文本的阅读区域在第一个链接中向上滑动,然后在此过程中像那样向后滑动。
源代码是使用 Snap 生成的,对我来说没有意义,而且我无权访问 Snap。我认为必须有一种方法可以使用 CSS 或 Javascript 来做到这一点
有什么帮助吗?
【问题讨论】:
-
请显示您拥有的代码以及您尝试过的代码。
-
嘿,Kirsch,您似乎忘记链接您的示例,请编辑您的帖子并添加示例,以便我们为您提供帮助。
-
谢谢。这次有链接吗?我对在问题中发布链接感到困惑
-
感谢 Scott Marcus 的编辑。几分钟前才注意到他们
标签: javascript html css hover