]> BookStack Code Mirror - bookstack/blobdiff - resources/js/services/animations.js
Fixed failing test after drawio default url change
[bookstack] / resources / js / services / animations.js
index b6158ea5f8fbee97872d6350f0a8fa72e9954c13..278a765d5802e2af4feefd1fb1cb26aeaee9b805 100644 (file)
@@ -5,6 +5,22 @@
  */
 const animateStylesCleanupMap = new WeakMap();
 
+/**
+ * Fade in the given element.
+ * @param {Element} element
+ * @param {Number} animTime
+ * @param {Function|null} onComplete
+ */
+export function fadeIn(element, animTime = 400, onComplete = null) {
+    cleanupExistingElementAnimation(element);
+    element.style.display = 'block';
+    animateStyles(element, {
+        opacity: ['0', '1']
+    }, animTime, () => {
+        if (onComplete) onComplete();
+    });
+}
+
 /**
  * Fade out the given element.
  * @param {Element} element