Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to keep an element in current state after animation is finished

starting position of the element is – outside of viewport
a css animation should start after 2sec
when finished – the element is inside the viewport – but how to keep it in the current state ?
in the example below abc should stay visible having top:54px

.abc{
  position:fixed;
  top:-100%;
  width:25px;
  height:54px;
  background:orange;
  animation-name:animaa;
  animation-delay:2s;
  animation-duration:2s;
}

@keyframes animaa{
  0% {top:-100%;}
  100% {top:54px;}
}
<div class='abc'></div>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The animation-fill-mode property specifies a style for the element when the animation is not playing (before it starts, after it ends, or both).

Add animation-fill-mode: forwards;. For example,

.abc{
  ...
  animation-fill-mode: forwards;
}

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading