【问题标题】:cross-fade gallery of images with 3 images left to it交叉淡入淡出的图片库,剩下 3 张图片
【发布时间】:2019-08-21 21:41:12
【问题描述】:

我有一个如下所示的小提琴,在 位置 4(图 4、图 5、图 6),我想要 cross-fade(fade-in/fade-out ) 图片库。目前该位置只显示图6

https://jsfiddle.net/k0vzthne/embedded/result

这是我在小提琴中使用的 CSS 代码。目前,我在位置 4 看不到任何交叉淡入(淡入/淡出)图像库。

.featured-block a:nth-of-type(4), .featured-block a:nth-of-type(5), .featured-block a:nth-of-type(6) {
  position: absolute;
  right: 568px;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-duration: 12s;
  opacity: 1;
}

.featured-block a:nth-of-type(4) {
  animation-delay: 0s;
}

.featured-block a:nth-of-type(5) {
  animation-delay: 4s;
}


.featured-block a:nth-of-type(6) {
  animation-delay: 8s;
}

@keyframes cf4FadeInOut {
  0% {opacity: 0;}
    20% {opacity: 1;z-index: 999;}
    33% {opacity: 1;}
    53% {opacity: 0;z-index: 1;}
    100% {opacity: 0;}
}

问题陈述:

我想知道我应该在 上面的 CSS 代码中进行哪些更改,以便 交叉淡入淡出图片库发生在 位置 4(包含图片 4、图片 5 和图片 6) 有 3 张图像左侧 出现在小提琴中,现在位于 位置 1、位置 2 和位置 3

【问题讨论】:

    标签: css css-animations fadein fadeout cross-fade


    【解决方案1】:

    如果我理解正确,也许这会有所帮助:

    .item
    {
      background: red;
      display: inline-block;
      position: relative;
      
      width: 60px;
      height: 60px;
    }
    
    .item:nth-child(2n)
    {
      position: absolute;
      transition: opacity 400ms ease-in-out;
      opacity: 0;
      right: 0;
    }
    
    .item:hover + .item
    {
      background: green;
      z-index: 1;
      opacity: 1;
    }
    <div class="list">
      <div class="item">1 </div>
      <div class="item">2 </div>
      <div class="item">3 </div>
      <div class="item">4 </div>
      <div class="item">5 </div>
      <div class="item">6 </div>
    </div>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多