A simple proof of concept where CSS3 animations with animation-fill-mode: forwards
is used to fade in elements created and added to DOM with JavaScript.
Last active
August 29, 2015 13:56
-
-
Save Haraldson/8869035 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$(function() | |
{ | |
var $dynamicallyCreatedElement = $('<p class="dynamically-created-element">This will fade in!</p>'); | |
$('body').append($dynamicallyCreatedElement); | |
}); |
This file contains hidden or 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
@keyframes fade-in { | |
0% { opacity: 0; } | |
100% { opacity: 1; } | |
} | |
.dynamically-created-element { | |
opacity: 0; | |
animation-name: fade-in; | |
animation-duration: .5s; | |
animation-timing-function: ease-in-out; | |
animation-iteration-count: 1; | |
animation-fill-mode: forwards; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment