Implement better flash behavior
This commit is contained in:
@ -24,11 +24,25 @@
|
||||
|
||||
var showFlashes = function() {
|
||||
$('.flash').each(function() {
|
||||
if ($(this).html() !== '') {
|
||||
$(this).slideDown().delay(DURATION).slideUp(function() {
|
||||
$(this).html('');
|
||||
var container = $(this);
|
||||
var message = container.children().first();
|
||||
var button = container.children().last();
|
||||
|
||||
var hide = function() {
|
||||
container.slideUp(function () {
|
||||
message.html('');
|
||||
});
|
||||
};
|
||||
|
||||
if (message.html() !== '') {
|
||||
container.slideDown();
|
||||
container.animation = setTimeout(hide, DURATION);
|
||||
}
|
||||
|
||||
button.on('click', function () {
|
||||
clearTimeout(container.animation);
|
||||
hide();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user