Sha256: 86bc62d0b5330555aeb2ccaf4d86019b8aa4578992cf8b942f146dd0f6294519
Contents?: true
Size: 1.24 KB
Versions: 4
Compression:
Stored size: 1.24 KB
Contents
(function () { 'use strict'; document.addEventListener('DOMContentLoaded', function() { var messagesContainer = document.querySelector('#alert-messages'), alertItems = messagesContainer.querySelectorAll('.alert'), alertItemCount = alertItems.length; function setOpacity(element, opacity, filterOpacity) { element.style.opacity = opacity; element.style.filter = 'alpha(opacity = ' + filterOpacity + ')'; } function fadeOutFlash(element, startLevel, endLevel, duration, callback) { var fadeInternal, level = startLevel; fadeInternal = setInterval(function() { if (level <= endLevel) { setOpacity(element, endLevel, endLevel); clearInterval(fadeInternal); if (typeof callback === 'function') { callback(true); } } else { level -= 0.1; setOpacity(element, level, (level * 100)); } }, duration); } //// // Fade flash messages out // for (var i = 0; i < alertItemCount; i += 1) { var item = alertItems[i]; setTimeout(function() { fadeOutFlash(item, 1, 0, 50, function() { item.parentNode.removeChild(item); }); }, 3000); } }); }());
Version data entries
4 entries across 4 versions & 1 rubygems