0

我正在尝试创建一种效果,使初始图像的显示时间比随后的动画图像长。我希望第一个项目出现 10 秒,其他项目显示 6 秒。我尝试调整时间,强制第一个图像不透明,并且注意到似乎很有效。我觉得我错过了一些关于它如何工作的关键。

我想我知道以下图像如何获得 6 秒的时间,但是是什么决定了第一个的动画时间?我可以告诉它在开始循环之前等待 4 秒钟,以便第一张图像在页面上停留更长时间吗?

.plattxt,
.goldtxt,
.coptxt {
  color: #6b6052;
  text-align: right;
  font-size: 12px;
  position: absolute;
  bottom: 0;
  width: 86%;
  margin-top: 93px;
  top: 0;
  font-weight: bold;
}

.item {
  width: 100%;
  height: 100px;
  display: inline-block;
  position: relative;
}

.items {
  background: white;
  border-radius: 10px;
  border: 4px solid #f6921e;
  min-height: 120px
}

.item .img-thumbnail {
  height: 100px;
  display: inline-block;
  position: relative;
}

.item img {
  max-height: 85px;
  top: 55px;
  left: 50%;
  margin-right: -50%;
  transform: translate(-50%, -50%);
  max-width: 230px;
  position: absolute;
}

.items h3 {
  text-align: center;
  font-size: 25px;
  color: #6b6052;
  font-weight: bold;
  margin-top: 24px;
  line-height: 30px;
}

#crossfade>.fadecont {
  display: block;
  color: transparent;
  opacity: 0;
  z-index: 0;
  -webkit-backface-visibility: hidden;
  -webkit-animation: imageAnimation 30s linear infinite 0s;
  -moz-animation: imageAnimation 30s linear infinite 0s;
  -o-animation: imageAnimation 30s linear infinite 0s;
  -ms-animation: imageAnimation 30s linear infinite 0s;
  animation: imageAnimation 30s linear infinite 0s;
}

#crossfade>.fadecont:nth-child(2) {
  -webkit-animation-delay: 6s;
  -moz-animation-delay: 6s;
  -o-animation-delay: 6s;
  -ms-animation-delay: 6s;
  animation-delay: 6s;
}

#crossfade>.fadecont:nth-child(3) {
  -webkit-animation-delay: 12s;
  -moz-animation-delay: 12s;
  -o-animation-delay: 12s;
  -ms-animation-delay: 12s;
  animation-delay: 12s;
}

#crossfade>.fadecont:nth-child(4) {
  -webkit-animation-delay: 18s;
  -moz-animation-delay: 18s;
  -o-animation-delay: 18s;
  -ms-animation-delay: 18s;
  animation-delay: 18s;
}

#crossfade>.fadecont:nth-child(5) {
  -webkit-animation-delay: 24s;
  -moz-animation-delay: 24s;
  -o-animation-delay: 24s;
  -ms-animation-delay: 24s;
  animation-delay: 24s;
}

@-webkit-keyframes imageAnimation {
  0% {
    opacity: 0;
    -webkit-animation-timing-function: ease-in;
  }
  8% {
    opacity: 1;
    -webkit-animation-timing-function: ease-out;
  }
  17% {
    opacity: 1
  }
  25% {
    opacity: 0
  }
  100% {
    opacity: 0
  }
}

@-moz-keyframes imageAnimation {
  0% {
    opacity: 0;
    -moz-animation-timing-function: ease-in;
  }
  8% {
    opacity: 1;
    -moz-animation-timing-function: ease-out;
  }
  17% {
    opacity: 1
  }
  25% {
    opacity: 0
  }
  100% {
    opacity: 0
  }
}

@-o-keyframes imageAnimation {
  0% {
    opacity: 0;
    -o-animation-timing-function: ease-in;
  }
  8% {
    opacity: 1;
    -o-animation-timing-function: ease-out;
  }
  17% {
    opacity: 1
  }
  25% {
    opacity: 0
  }
  100% {
    opacity: 0
  }
}

@-ms-keyframes imageAnimation {
  0% {
    opacity: 0;
    -ms-animation-timing-function: ease-in;
  }
  8% {
    opacity: 1;
    -ms-animation-timing-function: ease-out;
  }
  17% {
    opacity: 1
  }
  25% {
    opacity: 0
  }
  100% {
    opacity: 0
  }
}

@keyframes imageAnimation {
  0% {
    opacity: 0;
    animation-timing-function: ease-in;
  }
  8% {
    opacity: 1;
    animation-timing-function: ease-out;
  }
  17% {
    opacity: 1
  }
  25% {
    opacity: 0
  }
  100% {
    opacity: 0
  }
}
<div class="col-md-6 " style="margin-top: 20px;">
  <div class="items">
    <div class="row">
      <div class="col-md-6">
        <h3><i>Thank You to Our<br>2021 Sponsors!</i></h3>
      </div>

      <div class="col-md-6">
        <div class="item" id="crossfade">
          <div class="fadecont">
            <img class="img-responsive" src="#" />
            <span class="plattxt">Platinum</span>
          </div>
          <div class="fadecont">
            <img class="img-responsive" src="#" />
            <span class="goldtxt">Gold</span>
          </div>
          <div class="fadecont">
            <img class="img-responsive" src="#" />
            <span class="goldtxt">Gold</span>
          </div>
          <div class="fadecont">
            <img class="img-responsive" src="#" />
            <span class="goldtxt">Gold</span>
          </div>
          <div class="fadecont">
            <img class="img-responsive" src="#" />
            <span class="coptxt">Copper</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

4

0 回答 0