I'm developing a growl like notifications for my site, currently it's like this:
HTML:
<div id="growls"></div>
CSS:
#growls {
position: fixed;
right: 20px;
bottom: 20px;
}
.growl {
display: none;
}
JS:
function growl(message) {
if (growls < 5) {
growls = growls + 1;
$('<div class="growl short block">' + message + '</div>').prependTo('#growls').fadeIn('slow').delay(2000).fadeOut('slow', function() { growls = growls - 1 });
}
}
It basically put new 'growl' on top of existing ones, problem is, when old ones disappear, new 'growls' suddenly collapse down, very annoying if you are reading the message.
I'm thinking about making the new growl div position fixed after it display, but it's not very clean (tons of adding and subtracting from elements offset)
Is there any better way to do this?