X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/2b929f5d951e7a31ec3176607b9bcdbeeeb785f1..refs/pull/1646/head:/resources/assets/js/services/animations.js diff --git a/resources/assets/js/services/animations.js b/resources/assets/js/services/animations.js index 5cb90b70c..8a3e9a57b 100644 --- a/resources/assets/js/services/animations.js +++ b/resources/assets/js/services/animations.js @@ -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