Created
July 26, 2013 03:56
-
-
Save adamboduch/6086040 to your computer and use it in GitHub Desktop.
In chapter 4, of "jQuery UI Cookbook", effects are applied to days in addition to months. This isn't the intended behavior. The following code should properly differentiate between month adjustments, and other adjustments. Thanks to Dave Sharman for pointing out the issue.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function( $, undefined ) { | |
$.extend( $.datepicker, { | |
monthAdjusted: false, | |
_adjustDate: function ( id, offset, period ) { | |
var _super = $.datepicker.constructor.prototype; | |
// Tell _updateDatepicker() that the month is being adjusted. | |
if ( period === "M" ) { | |
this.monthAdjusted = true; | |
} | |
_super._adjustDate.call( this, id, offset, period ); | |
}, | |
_updateDatepicker: function( inst ) { | |
var self = this, | |
_super = $.datepicker.constructor.prototype; | |
// Don't do anything if we're not dealing a month change. | |
if ( !this.monthAdjusted ) { | |
return _super._updateDatepicker.call( this, inst ); | |
} | |
this.monthAdjusted = false; | |
inst.dpDiv.fadeOut( 500, function() { | |
inst.dpDiv.fadeIn( 300 ); | |
_super._updateDatepicker.call( self, inst ); | |
}); | |
} | |
}); | |
})( jQuery ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment