| 1 |
/** |
| 2 |
* Block Alert |
| 3 |
*/ |
| 4 |
const { |
| 5 |
Motion: { animate }, |
| 6 |
GHOSTKIT: { events }, |
| 7 |
} = window; |
| 8 |
|
| 9 |
events.on(document, 'click', '.ghostkit-alert-hide-button', (e) => { |
| 10 |
e.preventDefault(); |
| 11 |
|
| 12 |
const alert = e.delegateTarget.parentNode; |
| 13 |
|
| 14 |
events.trigger(alert, 'close.alert.gkt'); |
| 15 |
|
| 16 |
animate(alert, { opacity: 0 }, { duration: 0.5 }).finished.then(() => { |
| 17 |
alert.style.height = `${alert.offsetHeight}px`; |
| 18 |
alert.style.paddingTop = '0px'; |
| 19 |
alert.style.paddingBottom = '0px'; |
| 20 |
|
| 21 |
animate( |
| 22 |
alert, |
| 23 |
{ height: 0, marginTop: 0, marginBottom: 0 }, |
| 24 |
{ duration: 0.5 } |
| 25 |
).finished.then(() => { |
| 26 |
events.trigger(alert, 'closed.alert.gkt'); |
| 27 |
}); |
| 28 |
}); |
| 29 |
}); |
| 30 |
|