]> BookStack Code Mirror - bookstack/blobdiff - resources/assets/js/services/animations.js
Add error messages, fix LDAP error
[bookstack] / resources / assets / js / services / animations.js
index 5cb90b70c77cf13048ae82a4ec64df56977e58f0..8a3e9a57b4ac1a22a932981296570468f4a960f9 100644 (file)
@@ -1,3 +1,18 @@
+/**
+ * Fade out the given element.
+ * @param {Element} element
+ * @param {Number} animTime
+ * @param {Function|null} onComplete
+ */
+export function fadeOut(element, animTime = 400, onComplete = null) {
+    animateStyles(element, {
+        opacity: ['1', '0']
+    }, animTime, () => {
+        element.style.display = 'none';
+        if (onComplete) onComplete();
+    });
+}
+
 /**
  * Hide the element by sliding the contents upwards.
  * @param {Element} element