/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/html/php-507-156-038/main.html
40 строк
1 KB
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
<script> function showNotification(type, message, duration = 5000) { const container = document.getElementById('notificationContainer'); const notification = document.createElement('div'); notification.className = `notification ${type}`; notification.innerHTML = ` ${message} <button class="close-notification" aria-label="Закрыть">×</button> `; container.appendChild(notification); // Автоматическое скрытие const timer = setTimeout(() => { removeNotification(notification); }, duration); // Закрытие по клику notification.querySelector('.close-notification').addEventListener('click', () => { clearTimeout(timer); removeNotification(notification); }); } function removeNotification(el) { el.style.animation = 'slideOutRight 0.3s forwards'; setTimeout(() => el.remove(), 300); } // Анимация исчезновения const style = document.createElement('style'); style.textContent = ` @keyframes slideOutRight { to { transform: translateX(100%); opacity: 0; } } `; document.head.appendChild(style); </script>