# ghostkit/3.3.3/gutenberg/blocks/alert/frontend.js

Block Animations, Motion &amp; Scroll Effects – Ghost Kit, version 3.3.3. 30 lines.

- Page: https://pluginprobe.com/plugins/ghostkit/3.3.3/code/gutenberg/blocks/alert/frontend.js
- Raw: https://pluginprobe.com/plugins/ghostkit/3.3.3/raw/gutenberg/blocks/alert/frontend.js
- Modified: 2024-02-18T18:40:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ghostkit/3.3.3/code/gutenberg/blocks/alert/frontend.js#L10-L20`.

```javascript
/**
 * Block Alert
 */
const {
	Motion: { animate },
	GHOSTKIT: { events },
} = window;

events.on(document, 'click', '.ghostkit-alert-hide-button', (e) => {
	e.preventDefault();

	const alert = e.delegateTarget.parentNode;

	events.trigger(alert, 'close.alert.gkt');

	animate(alert, { opacity: 0 }, { duration: 0.5 }).finished.then(() => {
		alert.style.height = `${alert.offsetHeight}px`;
		alert.style.paddingTop = '0px';
		alert.style.paddingBottom = '0px';

		animate(
			alert,
			{ height: 0, marginTop: 0, marginBottom: 0 },
			{ duration: 0.5 }
		).finished.then(() => {
			events.trigger(alert, 'closed.alert.gkt');
		});
	});
});

```
