Jump to content
  • 0

Почему не работает animation-delay?


nikki4
 Share

Question

Задача - появление блока внизу экрана спустя определенное время.

например для теста через 5 секунд, в течение 3х секунд всплытие

.block {
display:block; width:100%;max-height:340px; height:220px; position:fixed; background:coral; bottom: 0;
max-width:900px;
animation:anim 3s;
animation-duration:anim 3s;
  
  -webkit-animation-delay: 5s;
    -moz-animation-delay: 5s;
    -o-animation-delay: 5s;
    animation-delay: 5s;
}

@keyframes anim {
from {bottom:-100%;}
to {bottom:0;}
}

Живой пример

 

Если не добавлять задержку выезжает через 3 сек.

если добавить - сразу появляется и задержки нет.

 

 

разобрался с вопросом. Надо было изначально скрыть блок и в анимацию добавить появление:

@keyframes show{
	 0%{
		 opacity:1;
	 }
	 
	 
	 100% {
		 opacity:1;
	 }
	 from {bottom:-100%;}
to {bottom:0;}

}

 

Edited by nikki4
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy