Browse Source

Adds duration object for dimmer, modal now always appears quicker than and hides later than modal preventing issues with callbacks

Former-commit-id: d0206eb8e7
Former-commit-id: 75dbfe7f9c
pull/258/head
jlukic 11 years ago
parent
commit
b5912ae819
2 changed files with 26 additions and 9 deletions
  1. 24
      src/modules/dimmer.js
  2. 11
      src/modules/modal.js

24
src/modules/dimmer.js

@ -151,7 +151,7 @@ $.fn.dimmer = function(parameters) {
module.set.dimmed();
if($.fn.transition !== undefined) {
$dimmer
.transition(settings.transition + ' in', settings.duration, function() {
.transition(settings.transition + ' in', module.get.duration(), function() {
module.set.active();
callback();
})
@ -166,7 +166,7 @@ $.fn.dimmer = function(parameters) {
width : '100%',
height : '100%'
})
.fadeTo(settings.duration, 1, function() {
.fadeTo(module.get.duration(), 1, function() {
$dimmer.removeAttr('style');
module.set.active();
callback();
@ -180,7 +180,7 @@ $.fn.dimmer = function(parameters) {
if($.fn.transition !== undefined) {
module.verbose('Hiding dimmer with css');
$dimmer
.transition(settings.transition + ' out', settings.duration, function() {
.transition(settings.transition + ' out', module.get.duration(), function() {
module.remove.active();
callback();
})
@ -190,7 +190,7 @@ $.fn.dimmer = function(parameters) {
module.verbose('Hiding dimmer with javascript');
$dimmer
.stop()
.fadeOut(settings.duration, function() {
.fadeOut(module.get.duration(), function() {
$dimmer.removeAttr('style');
module.remove.active();
callback();
@ -203,6 +203,17 @@ $.fn.dimmer = function(parameters) {
get: {
dimmer: function() {
return $dimmer;
},
duration: function() {
if(typeof settings.duration == 'object') {
if( module.is.active() ) {
return settings.duration.hide;
}
else {
return settings.duration.show;
}
}
return settings.duration;
}
},
@ -512,7 +523,10 @@ $.fn.dimmer.settings = {
on : false,
closable : true,
duration : 500,
duration : {
show : 500,
hide : 500
},
onChange : function(){},
onShow : function(){},

11
src/modules/modal.js

@ -197,7 +197,7 @@ $.fn.modal = function(parameters) {
module.debug('Hiding modal');
// remove keyboard detection
$document
.off('keyup.' + namespace)
.off('keyup.' + eventNamespace)
;
if(settings.transition && $.fn.transition !== undefined) {
$module
@ -242,7 +242,7 @@ $.fn.modal = function(parameters) {
restore: {
focus: function() {
$focusedElement.focus();
$focusedElement.focus();
}
},
@ -292,7 +292,10 @@ $.fn.modal = function(parameters) {
module.debug('Setting dimmer settings', settings.closable);
$context
.dimmer('setting', 'closable', settings.closable)
.dimmer('setting', 'duration', settings.duration * 0.75)
.dimmer('setting', 'duration', {
show : settings.duration * 0.95,
hide : settings.duration * 1.05
})
.dimmer('setting', 'onShow' , module.add.keyboardShortcuts)
.dimmer('setting', 'onHide', function() {
module.hide();
@ -526,7 +529,7 @@ $.fn.modal.settings = {
closable : true,
context : 'body',
duration : 600,
duration : 500,
easing : 'easeOutExpo',
offset : 0,
transition : 'scale',

Loading…
Cancel
Save