Datepicker - Fixed #4787 - Datepicker: fix animation control

This commit is contained in:
Keith Wood 2009-11-29 22:56:30 +00:00
parent 2b12ea0308
commit 378260f132

View File

@ -607,7 +607,7 @@ $.extend(Datepicker.prototype, {
'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
left: offset.left + 'px', top: offset.top + 'px'}); left: offset.left + 'px', top: offset.top + 'px'});
if (!inst.inline) { if (!inst.inline) {
var showAnim = $.datepicker._get(inst, 'showAnim') || 'show'; var showAnim = $.datepicker._get(inst, 'showAnim');
var duration = $.datepicker._get(inst, 'duration'); var duration = $.datepicker._get(inst, 'duration');
var postProcess = function() { var postProcess = function() {
$.datepicker._datepickerShowing = true; $.datepicker._datepickerShowing = true;
@ -619,8 +619,8 @@ $.extend(Datepicker.prototype, {
if ($.effects && $.effects[showAnim]) if ($.effects && $.effects[showAnim])
inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
else else
inst.dpDiv[showAnim](duration, postProcess); inst.dpDiv[showAnim || 'show']((showAnim ? duration : ''), postProcess);
if (duration == '') if (!showAnim)
postProcess(); postProcess();
if (inst.input[0].type != 'hidden') if (inst.input[0].type != 'hidden')
inst.input[0].focus(); inst.input[0].focus();
@ -720,19 +720,18 @@ $.extend(Datepicker.prototype, {
if (!inst || (input && inst != $.data(input, PROP_NAME))) if (!inst || (input && inst != $.data(input, PROP_NAME)))
return; return;
if (this._datepickerShowing) { if (this._datepickerShowing) {
duration = (duration != null ? duration : this._get(inst, 'duration')); duration = duration || this._get(inst, 'duration');
var showAnim = this._get(inst, 'showAnim'); var showAnim = this._get(inst, 'showAnim');
var postProcess = function() { var postProcess = function() {
$.datepicker._tidyDialog(inst); $.datepicker._tidyDialog(inst);
}; };
if (duration != '' && $.effects && $.effects[showAnim]) if ($.effects && $.effects[showAnim])
inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
duration, postProcess);
else else
inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' : inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
(showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess); (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : ''), postProcess);
if (duration == '') if (!showAnim)
this._tidyDialog(inst); postProcess();
var onClose = this._get(inst, 'onClose'); var onClose = this._get(inst, 'onClose');
if (onClose) if (onClose)
onClose.apply((inst.input ? inst.input[0] : null), onClose.apply((inst.input ? inst.input[0] : null),