diff options
Diffstat (limited to 'static/alert-timeout.js')
-rw-r--r-- | static/alert-timeout.js | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/static/alert-timeout.js b/static/alert-timeout.js index 6fe6def..e20106f 100644 --- a/static/alert-timeout.js +++ b/static/alert-timeout.js @@ -1,13 +1,8 @@ -Array.from(document.getElementsByClassName('kysAlert')).forEach( (a) => { - a.addEventListener('click', (event) => { - event.target.remove(); - }) - setTimeout( () => { - Array.from(document.getElementsByClassName('kysAlert')) - .forEach( (a) => { - if (a.style.transition=="opacity 2s") a.remove() - a.style.transition="opacity 2s" - a.style.opacity=0; - } ) - }, 5000) - }) +setInterval( () => { + Array.from(document.getElementsByClassName('kysAlert')).forEach( (a)=>{ + a.addEventListener('click', (event) => { event.target.remove() } ) + if (a.style.transition=="opacity 2s") a.remove() + a.style.transition="opacity 2s" + a.style.opacity=0; + } ) +}, 5000) |