mirror of
https://github.com/chinchang/web-maker.git
synced 2025-06-07 10:06:08 +02:00
notifications.js: prevent multiple hide timeouts from getting added.
This commit is contained in:
parent
abccf89b97
commit
d6fc01dbbc
@ -1,5 +1,6 @@
|
||||
(function() {
|
||||
var noticationContainerEL = $('#js-alerts-container');
|
||||
const noticationContainerEL = $('#js-alerts-container');
|
||||
var hideTimeout;
|
||||
|
||||
function addNotification(msg) {
|
||||
// var n = document.createElement('div');
|
||||
@ -8,7 +9,8 @@
|
||||
noticationContainerEL.textContent = msg;
|
||||
noticationContainerEL.classList.add('is-active');
|
||||
|
||||
setTimeout(function() {
|
||||
clearTimeout(hideTimeout);
|
||||
hideTimeout = setTimeout(function() {
|
||||
noticationContainerEL.classList.remove('is-active');
|
||||
}, 2000);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user