您可以使用CSS轉換完成該效果(請參閱一些基本的examples here)。
看到這個爲你的例子at this JSFiddle(不是一個特別乾淨的例子,但它應該說明的概念)。
爲了清晰起見,我已將您的網站的標記加以簡化。現在
<div class="employee-thumb pull-left">
<div class="inner">
<img width="150" height="150" src="http://i.forbesimg.com/media/lists/people/elon-musk_416x416.jpg" />
<div class="info">
<p>Elon Musk</p>
<p>Additional information including buttons</p>
</div>
</div>
</div>
在CSS,我們可以設置.info
要絕對定位相對定位的父內,.inner
。由於.inner
的溢出隱藏,因此可以通過調整絕對位置將內容推送到我們的可視範圍之外。
.inner {
position: relative;
overflow: hidden;
max-width: 150px;
}
.inner .info {
background-color: rgba(255,255,255,0.7);
position: absolute;
bottom: -4em;
}
在鼠標懸停在.inner
,.info
,底部返回的絕對定位爲0,滑動內容。
.inner:hover .info {
bottom: 0em;
}
而且我們使用CSS過渡動畫整個事情。
.inner .info {
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease; -o-transition: all 0.3s ease;
}
Your site throws Forbidden Error。創建一個plunkr並告訴我們你做了什麼 – WhatisSober
對不起,你走了:http://sealfitdev.demosite.us/coaching-staff/ – Hashtag
你需要顯示你在這個網站上做了什麼。無論如何,這裏是教程:http://www.kirupa.com/html5/slide_image_hover_using_css3.htm – WhatisSober