diff --git a/js/modal.js b/js/modal.js index e71c8e5..b3b3ba0 100755 --- a/js/modal.js +++ b/js/modal.js @@ -29,8 +29,13 @@ $('input[autofocus="autofocus"]') .focus(); }); - $('#modal, #modal-overlay') - .fadeIn(200); + // If a plugin has provided a custom load animation + if(typeof codiad.modal.onLoadAnimation == "function") { + codiad.modal.onLoadAnimation(); + } else { + $('#modal, #modal-overlay') + .fadeIn(200); + } codiad.sidebars.modalLock = true; }, @@ -43,10 +48,17 @@ this._setBounds(); $('#modal-content form') .die('submit'); // Prevent form bubbling - $('#modal, #modal-overlay') - .fadeOut(200); - $('#modal-content') - .html(''); + // If a plugin has provided a custom unload animation (note + // that the custom animation function is responsible for removing + // the HTML from the modal) + if(typeof codiad.modal.onUnloadAnimation == "function") { + codiad.modal.onUnloadAnimation(); + } else { + $('#modal, #modal-overlay') + .fadeOut(200); + $('#modal-content') + .html(''); + } codiad.sidebars.modalLock = false; if (!codiad.sidebars.leftLock) { // Slide sidebar back $('#sb-left')