I would like one CSS class that when an element is added to the document.body
it would animate in with max-width
currently I know how to do it with two classes and adding the second class after. But I need to add many elements to the page and it would be much cleaner to do it with one class.
Id like to convert this to use one class: http://codepen.io/hellomihai/pen/yYBPjW
css:
.hide-me {
overflow: hidden;
max-width: 0;
}
.show-me {
max-width: 1000px;
transition: max-width 5s;
}
.my-stuff {
height: 200px;
width: 600px;
background-color: red;
}
html:
$(document).ready(function() {
var newDiv = document.createElement("div");
document.body.appendChild(newDiv);
newDiv.className = 'my-stuff hide-me';
setTimeout(function() {
$('.my-stuff').addClass('show-me');
}, 1);
});