在这个网站上使用了什么CSS悬停效果?

时间:2015-03-06 07:15:26

标签: jquery css

我希望找到一个jquery效果,就像本网站http://ngelectrical.com.au/上5个图标中的一个。 它悬停在...时滑开。

有人可以帮我找到有关此效果的更多信息吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

这是一个没有任何Javascript的例子。它甚至不使用CSS动画,只是一些过渡:

@import url(http://fonts.googleapis.com/css?family=Open+Sans);
body {
  background: #ccc;
  font-family: 'Open Sans', sans-serif;
}
.card {
  position: relative;
  float: left;
  text-align: center;
  width: 100px;
  padding: 20px 20px 10px;
  margin: 20px;
  border-radius: 5px;
  -webkit-transition: all 1s;
  transition: all 1s;
}
.card:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 45px;
  border-radius: 5px 5px 0 0;
  background: url(http://lorempixel.com/140/45/abstract/);
  z-index: 10;
  opacity: 0;
  -webkit-transition: all 1s;
  transition: all 1s;
}
.card i {
  position: relative;
  display: block;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #333;
  box-shadow: 0 0 0 5px #fff;
  color: #fff;
  font-size: 30px;
  line-height: 50px;
  margin: 0 auto 10px;
  z-index: 20;
  -webkit-transition: all 1s;
  transition: all 1s;
}
.card h2 {
  text-transform: uppercase;
  font-weight: bold;
  line-height: 40px;
  -webkit-transition: all 1s;
  transition: all 1s;
}
.card p {
  line-height: 20px;
  font-size: 14px;
  height: 0;
  opacity: 0;
  -webkit-transition: all 0s;
  transition: all 0s;
}
.card:hover {
  background: #fff;
  box-shadow: 0 0 3px #333;
}
.card:hover:before {
  opacity: 1;
}
.card:hover i {
  background: orange;
}
.card:hover h2 {
  color: orange;
}
.card:hover p {
  height: auto;
  opacity: 1;
  -webkit-transition: all 1s;
  transition: all 1s;
}
<div class="card">
  <i>♥</i>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim.</p>
  <h2>Foo</h2>
</div>

<div class="card">
  <i>♦</i>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim.</p>
  <h2>Bar</h2>
</div>

<div class="card">
  <i>♣</i>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim.</p>
  <h2>Baz</h2>
</div>