Reputation: 887
I'm trying zoom in animation for background image for a particular second. it's happening but it resets again.
i created sample link in jsfiddle: https://jsfiddle.net/onlinesolution/tk6rcLdx/
what am i missing here?
body:before{
content:"";
position:absolute;
top:0px;
left:0px;
height: 100vh;
width: 100%;
background-image: url("http://paulmason.name/media/demos/full-screen-background-image/background.jpg");
background-position:center center;
background-size: 100% 100%;
background-repeat: no-repeat;
z-index: -9;
-webkit-animation: zoomin 5s ease-in;
animation: zoomin 5s ease-in;
}
/* Zoom in Keyframes */
@-webkit-keyframes zoomin {
0% {transform: scale(1);}
100% {transform: scale(1.5);}
}
@keyframes zoomin {
0% {transform: scale(1);}
100% {transform: scale(1.5);}
} /*End of Zoom in Keyframes */
Upvotes: 0
Views: 1975
Reputation: 506
You're missing a simple propertie: animation-fill-mode: forwards
Here's your code with that propertie added, you will see that works fine
https://codepen.io/manAbl/pen/vjbgYK
Further reading:
https://devdocs.io/css/animation-fill-mode
Upvotes: 1