CSS转换在鼠标悬停时逐个显示框

San*_*mar 1 html css jquery css3 css-transitions

我创建了一个社交媒体框,当你将鼠标悬停在分享按钮上时,它将弹出并显示社交媒体图标,它现在正常工作,但我想要转换它,所以当我鼠标悬停在共享按钮上时其他4项逐个显示一些过渡效果.

我正在寻找的效果类似于这个网站,在右上角.

body {
  background: #cdcdcd;
  padding: 150px 0 0 100px;
}
.social-share {
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.3);
  color: #34abd2;
  float: left;
  font-size: 18px;
  height: 35px;
  line-height: 35px;
  position: relative;
  text-align: center;
  width: 35px;
  cursor: pointer;
}
.social-share > ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.social-share > ul > li {
  list-style: none;
}
.social-share > ul > li > i {
  transition: all 0.5s ease 0s;
}
.social-share > ul > li:hover > i {
  -ms-transform: rotate(180deg);
  -webkit-transform: rotate(180deg);
  transform: rotate(180deg);
}
.social-share > ul > li > ul {
  line-height: none;
  padding: 0;
  margin: 0 auto;
  left: 0;
  right: 0;
  position: absolute;
  bottom: 35px;
  line-height: normal;
  visibility: hidden;
}
.social-share > ul > li:hover ul {
  visibility: visible;
}
.social-share > ul > li > ul > li {
  list-style: none;
  background-color: #fff;
  margin-bottom: 3px;
  display: inline-block;
  width: 35px;
  height: 35px;
  line-height: 35px;
  border-radius: 50%;
}
.social-share > ul > li > ul > li > a {
  color: #fff;
}
.social-share > ul > li > ul > li:nth-child(1) {
  background-color: #3C5A99;
}
.social-share > ul > li > ul > li:nth-child(2) {
  background-color: #229EF1;
}
.social-share > ul > li > ul > li:nth-child(3) {
  background-color: #DD4A40;
}
.social-share > ul > li > ul > li:nth-child(4) {
  background-color: #2FA64A;
}
Run Code Online (Sandbox Code Playgroud)
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet"/>
<div class="social-share">
  <ul>
    <li><i class="fa fa-share-alt" aria-hidden="true"></i>
      <ul>
        <li><a href="#"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
        <li><a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
        <li><a href="#"><i class="fa fa-google-plus" aria-hidden="true"></i></a></li>
        <li><a href="#"><i class="fa fa-whatsapp" aria-hidden="true"></i></a></li>
      </ul>
    </li>
  </ul>
</div>
Run Code Online (Sandbox Code Playgroud)

Adr*_*ski 5

我认为transition-delay是你的答案

body {
  background: #cdcdcd;
  padding: 150px 0 0 100px;
}
.social-share {
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.3);
  color: #34abd2;
  float: left;
  font-size: 18px;
  height: 35px;
  line-height: 35px;
  position: relative;
  text-align: center;
  width: 35px;
  cursor: pointer;
}
.social-share > ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.social-share > ul > li {
  list-style: none;
}
.social-share > ul > li > i {
  transition: all 0.5s ease 0s;
}
.social-share > ul > li:hover > i {
  -ms-transform: rotate(180deg);
  -webkit-transform: rotate(180deg);
  transform: rotate(180deg);
}
.social-share > ul > li > ul {
  line-height: none;
  padding: 0;
  margin: 0 auto;
  left: 0;
  right: 0;
  position: absolute;
  bottom: 35px;
  line-height: normal;
  visibility: hidden;
}
.social-share > ul > li:hover ul {
  visibility: visible;
}
.social-share > ul > li > ul > li {
  list-style: none;
  background-color: #fff;
  margin-bottom: 3px;
  display: inline-block;
  width: 35px;
  height: 35px;
  line-height: 35px;
  border-radius: 50%;
}
.social-share > ul > li > ul > li > a {
  color: #fff;
}
.social-share > ul > li > ul > li:nth-child(1) {
  background-color: #3C5A99;
  transition-delay: 0ms;
}
.social-share > ul > li > ul > li:nth-child(2) {
  background-color: #229EF1;
  transition-delay: 500ms;
}
.social-share > ul > li > ul > li:nth-child(3) {
  background-color: #DD4A40;
  transition-delay: 1000ms;
}
.social-share > ul > li > ul > li:nth-child(4) {
  background-color: #2FA64A;
  transition-delay: 1500ms;
}

.social-share > ul > li:hover > ul > li:nth-child(1) {
  transition-delay: 1500ms;
}
.social-share > ul > li:hover > ul > li:nth-child(2) {
  transition-delay: 1000ms;
}
.social-share > ul > li:hover > ul > li:nth-child(3) {
  transition-delay: 500ms;
}
.social-share > ul > li:hover > ul > li:nth-child(4) {
  transition-delay: 0ms;
}
Run Code Online (Sandbox Code Playgroud)
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet"/>
<div class="social-share">
  <ul>
    <li><i class="fa fa-share-alt" aria-hidden="true"></i>
      <ul>
        <li><a href="#"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
        <li><a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
        <li><a href="#"><i class="fa fa-google-plus" aria-hidden="true"></i></a></li>
        <li><a href="#"><i class="fa fa-whatsapp" aria-hidden="true"></i></a></li>
      </ul>
    </li>
  </ul>
</div>
Run Code Online (Sandbox Code Playgroud)

  • 我的意思是当你悬停共享时,图标一个接一个地显示在底部,当悬停在顶部时一个接一个地隐藏 (2认同)