I have a <div>
whose height I don't know at page load.
How can I make it slide into view when page loads, and sticking to the bottom of the page?
I expected this code to work, but the div
just jumps straight into view without a smooth animation.
var $warning = $('.bottom-warning');
var height = $warning.outerHeight();
/* Put div right below screen */
$warning.css('bottom', -height);
/* Make it visible */
$warning.css('display', 'inline-block');
/* Configure transition */
$warning.css('transition', 'bottom 400ms');
/* Apply new value */
/* SHOULDN'T VALUE BE ANIMATED? */
$warning.css('bottom', 0);
If the last line is set to run later (with setTimeout
) then it works, but I would like to avoid this as it is bad practice.
Requirement: use native CSS3 transitions or animations, no Javascript animating (including jQuery animations)