Last active
September 24, 2019 18:05
-
-
Save katienelson/a6aec154939b975b6320 to your computer and use it in GitHub Desktop.
Slide Up Fade In - Keyframe animation and CSS class. Apply .slide-up-fade-in to element you wish to apply the effect. Demo on http://codepen.io/katienelson/pen/KwXEzN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="outer-square"> | |
<div class="square slide-up-fade-in"> | |
<h3 class="slide-up-fade-in">Title</h3> | |
<p class="slide-up-fade-in">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> | |
<p class="slide-up-fade-in">Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> | |
</div> | |
<div class="clearfix"></div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.outer-square{ | |
width:350px; | |
height:350px; | |
background:#bbb; | |
opacity:0.5; | |
margin:0 auto; | |
padding:50px; | |
margin-top:50px; | |
} | |
.square{ | |
width:310px; | |
height:320px; | |
background:#ddd; | |
margin:0 auto; | |
position:relative; | |
opacity:0.9; | |
padding:15px 20px; | |
border:1px solid #eee; | |
} | |
h3{ | |
text-align:center; | |
} | |
p{ | |
margin-bottom:15px; | |
} | |
.slide-up-fade-in{ | |
animation: slide-up-fade-in ease 1s; | |
animation-iteration-count: 1; | |
transform-origin: 50% 50%; | |
animation-fill-mode:forwards; /*when the spec is finished*/ | |
-webkit-animation: slide-up-fade-in ease 1s; | |
-webkit-animation-iteration-count: 1; | |
-webkit-transform-origin: 50% 50%; | |
-webkit-animation-fill-mode:forwards; /*Chrome 16+, Safari 4+*/ | |
-moz-animation: slide-up-fade-in ease 1s; | |
-moz-animation-iteration-count: 1; | |
-moz-transform-origin: 50% 50%; | |
-moz-animation-fill-mode:forwards; /*FF 5+*/ | |
-o-animation: slide-up-fade-in ease 1s; | |
-o-animation-iteration-count: 1; | |
-o-transform-origin: 50% 50%; | |
-o-animation-fill-mode:forwards; /*Not implemented yet*/ | |
-ms-animation: slide-up-fade-in ease 1s; | |
-ms-animation-iteration-count: 1; | |
-ms-transform-origin: 50% 50%; | |
-ms-animation-fill-mode:forwards; /*IE 10+*/ | |
opacity:0; | |
opacity: 1\9; | |
} | |
@keyframes slide-up-fade-in{ | |
0% { | |
opacity:0; | |
transform: translate(0px,40px) ; | |
} | |
100% { | |
opacity:1; | |
transform: translate(0px,0px) ; | |
} | |
} | |
@-moz-keyframes slide-up-fade-in{ | |
0% { | |
opacity:0; | |
-moz-transform: translate(0px,40px) ; | |
} | |
100% { | |
opacity:1; | |
-moz-transform: translate(0px,0px) ; | |
} | |
} | |
@-webkit-keyframes slide-up-fade-in { | |
0% { | |
opacity:0; | |
-webkit-transform: translate(0px,40px) ; | |
} | |
100% { | |
opacity:1; | |
-webkit-transform: translate(0px,0px) ; | |
} | |
} | |
@-o-keyframes slide-up-fade-in { | |
0% { | |
opacity:0; | |
-o-transform: translate(0px,40px) ; | |
} | |
100% { | |
opacity:1; | |
-o-transform: translate(0px,0px) ; | |
} | |
} | |
@-ms-keyframes slide-up-fade-in { | |
0% { | |
opacity:0; | |
-ms-transform: translate(0px,40px) ; | |
} | |
100% { | |
opacity:1; | |
-ms-transform: translate(0px,0px) ; | |
} | |
} | |
.clearfix {clear: both; zoom: 1;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment