This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Modal's close animation's duration is hardcoded (!) #2585
Labels
Milestone
Comments
OnkelTem
changed the title
Modal close animation is hardcoded
Modal close animation duration is hardcoded (!)
Aug 14, 2014
OnkelTem
changed the title
Modal close animation duration is hardcoded (!)
Modal's close animation's duration is hardcoded (!)
Aug 14, 2014
Here is a patch which adds such configuration: diff --git a/src/modal/modal.js b/src/modal/modal.js
index c753b5f..dd5cb83 100644
--- a/src/modal/modal.js
+++ b/src/modal/modal.js
@@ -144,18 +144,18 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition'])
openedWindows.remove(modalInstance);
//remove window DOM element
- removeAfterAnimate(modalWindow.modalDomEl, modalWindow.modalScope, 300, function() {
+ removeAfterAnimate(modalWindow.modalDomEl, modalWindow.modalScope, modalWindow.windowCloseDuration, function() {
modalWindow.modalScope.$destroy();
body.toggleClass(OPENED_MODAL_CLASS, openedWindows.length() > 0);
- checkRemoveBackdrop();
+ checkRemoveBackdrop(modalWindow.backdropCloseDuration);
});
}
- function checkRemoveBackdrop() {
+ function checkRemoveBackdrop(closeDuration) {
//remove backdrop if no longer needed
if (backdropDomEl && backdropIndex() == -1) {
var backdropScopeRef = backdropScope;
- removeAfterAnimate(backdropDomEl, backdropScope, 150, function () {
+ removeAfterAnimate(backdropDomEl, backdropScope, closeDuration, function () {
backdropScopeRef.$destroy();
backdropScopeRef = null;
});
@@ -216,6 +216,8 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition'])
deferred: modal.deferred,
modalScope: modal.scope,
backdrop: modal.backdrop,
+ backdropCloseDuration: modal.backdropCloseDuration,
+ windowCloseDuration: modal.windowCloseDuration,
keyboard: modal.keyboard
});
@@ -280,7 +282,9 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition'])
var $modalProvider = {
options: {
backdrop: true, //can be also false or 'static'
- keyboard: true
+ keyboard: true,
+ backdropCloseDuration: 150,
+ windowCloseDuration: 300
},
$get: ['$injector', '$rootScope', '$q', '$http', '$templateCache', '$controller', '$modalStack',
function ($injector, $rootScope, $q, $http, $templateCache, $controller, $modalStack) {
@@ -359,6 +363,8 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition'])
deferred: modalResultDeferred,
content: tplAndVars[0],
backdrop: modalOptions.backdrop,
+ backdropCloseDuration: modalOptions.backdropCloseDuration,
+ windowCloseDuration: modalOptions.windowCloseDuration,
keyboard: modalOptions.keyboard,
windowClass: modalOptions.windowClass,
windowTemplateUrl: modalOptions.windowTemplateUrl,
|
This will be resolved via #2724 . |
chrisirhc
added a commit
to chrisirhc/angular-ui-bootstrap
that referenced
this issue
Oct 20, 2014
- Fix scope.$apply call not working previously because scope was already destroyed. Use $rootScope instead. - Move $destroy call nearer to the dom removal. - Remove fallback timer (emulateTime param) Fixes angular-ui#2585 Fixes angular-ui#2674 Fixes angular-ui#2536 Fixes angular-ui#2790
chrisirhc
added a commit
to chrisirhc/angular-ui-bootstrap
that referenced
this issue
Mar 19, 2015
- Fix scope.$apply call not working previously because scope was already destroyed. Use $rootScope instead. - Move $destroy call nearer to the dom removal. - Remove fallback timer (emulateTime param) Fixes angular-ui#2585 Fixes angular-ui#2674 Fixes angular-ui#2536 Fixes angular-ui#2790 Fixes angular-ui#3182
chrisirhc
added a commit
to chrisirhc/angular-ui-bootstrap
that referenced
this issue
Mar 23, 2015
- Fix scope.$apply call not working previously because scope was already destroyed. Use $rootScope instead. - Move $destroy call nearer to the dom removal. - Remove fallback timer (emulateTime param) Fixes angular-ui#2585 Fixes angular-ui#2674 Fixes angular-ui#2536 Fixes angular-ui#2790 Fixes angular-ui#3182 Closes angular-ui#2724
ayakovlevgh
pushed a commit
to ayakovlevgh/bootstrap
that referenced
this issue
Mar 24, 2015
- Fix scope.$apply call not working previously because scope was already destroyed. Use $rootScope instead. - Move $destroy call nearer to the dom removal. - Remove fallback timer (emulateTime param) Fixes angular-ui#2585 Fixes angular-ui#2674 Fixes angular-ui#2536 Fixes angular-ui#2790 Fixes angular-ui#3182 Closes angular-ui#2724
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Closing modals now laggy, as 300 and 150 more ms are hardcoded. I'm not sure why this is done so, as from the one hand, someone like doesn't need any lags when closing modals, and from the other hand - someone may want some animation which lasts for more then 300 + 150 ms. As CSS animation and JS are not correlated directly, this should be configurable. So I vote for moving this into options.
The text was updated successfully, but these errors were encountered: