简体   繁体   English

如何在CSS上延迟动画? 我尝试了动画延迟。 不起作用

[英]How to delay animation on CSS? I've tried animation-delay. Doesn't work

I've created really good slides in CSS but I want them to show after another. 我已经在CSS中创建了非常不错的幻灯片,但我希望它们能陆续显示。 For example, I've got this animation below and no matter how higher I use animation-delay parameter, it simply won't work. 例如,下面有这个动画,无论我使用animation-delay参数多高,它都根本不起作用。 I need this to work as a second slide. 我需要将此作为第二张幻灯片。 It must appear 30s after the first one. 它必须在第一个出现30秒后出现。

  .slideInLeft2 {  /* do slide 2*/
  -webkit-animation-name: slideInLeft2;
  animation-name: slideInLeft2;
  -webkit-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-fill-mode: both;
  -webkit-animation-delay: 111s;
  -moz-animation: fadein 3s ease-in; /* Firefox */
  -webkit-animation: fadein 3s ease-in; /* Safari and Chrome */
  -o-animation: fadein 3s ease-in; /* Opera */
  animation: fadein 3s ease-in-out;
    }
  animation-delay: 11s;
  animation-fill-mode: both;
  }
  @-webkit-keyframes slideInLeft2 {
  0% {
  -webkit-transform: translateX(-100%);
  transform: translateX(-100%);
  visibility: visible;
  }
  100% {
  -webkit-transform: translateX(0);
  transform: translateX(0);
  }
  }
  @keyframes slideInLeft2 {
  0% {
  -webkit-transform: translateX(-400%);
  transform: translateX(-400%);
  visibility: visible;
  }
  100% {
  -webkit-transform: translateX(0);
  }
  {
  transform: translateX(0);
}
  } 

I think it's a typo, you set it to 111 seconds on line 7... 我认为这是一个错字,您在第7行将其设置为111秒...

-webkit-animation-delay: 111s;

It should be - 它应该是 -

-webkit-animation-delay: 11s;

you override your code with 您可以使用覆盖代码

animation: fadein 3s ease-in-out;

you should put delay in this part too, like this: 您也应该在这部分延迟,例如:

animation: fadein 3s ease-in-out 111s;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM