How does stackoverflow create the slidedown effect to alert a user of a change ?
Stack Overflow uses the jQuery framework, which has a method to show a hidden element using a simple animation, something like:
$('#notification-bar').show('slow');
http://api.jquery.com/show/ (check out the demos).
It is fixed to the top of the page using position:fixed
in CSS:
#notification-bar {
position:fixed;
top: 0px;
left: 0px;
width: 100%;
}
I think they use a timed event: jQuery Timed Event
Which sends an AJAX call to the SO severs: http://api.jquery.com/jQuery.ajax/
And then shows it in the div using the effect Andy E mentioned
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With