@@ -287,6 +287,7 @@ var DatePicker = new Class({
287287 } ,
288288
289289 fx : function ( fx ) {
290+ this . newContents . setStyle ( 'display' , 'block' ) ;
290291 if ( fx == 'right' ) {
291292 this . oldContents . setStyles ( { left : 0 , opacity : 1 } ) ;
292293 this . newContents . setStyles ( { left : this . bodysize . x , opacity : 1 } ) ;
@@ -297,7 +298,13 @@ var DatePicker = new Class({
297298 this . slider . setStyle ( 'left' , - this . bodysize . x ) . tween ( 'left' , - this . bodysize . x , 0 ) ;
298299 } else if ( fx == 'fade' ) {
299300 this . slider . setStyle ( 'left' , 0 ) ;
300- this . oldContents . setStyle ( 'left' , 0 ) . set ( 'tween' , { duration : this . options . animationDuration / 2 } ) . tween ( 'opacity' , 1 , 0 ) ;
301+ this . oldContents . addClass ( 'tween_dispose' ) ;
302+ this . oldContents . setStyle ( 'left' , 0 ) . set ( 'tween' , { duration : this . options . animationDuration / 2 , onComplete : function ( ) {
303+ $$ ( '.tween_dispose' ) . each ( function ( d ) {
304+ d . setStyle ( 'display' , 'none' ) ;
305+ d . removeClass ( 'tween_dispose' ) ;
306+ } ) ;
307+ } } ) . tween ( 'opacity' , 1 , 0 ) ;
301308 this . newContents . setStyles ( { opacity : 0 , left : 0 } ) . set ( 'tween' , { duration : this . options . animationDuration } ) . tween ( 'opacity' , 0 , 1 ) ;
302309 }
303310 } ,
@@ -427,8 +434,8 @@ var DatePicker = new Class({
427434 available = true ;
428435 e . addEvent ( 'click' , function ( e , d ) {
429436 if ( this . options . timePicker ) {
430- this . d . setDate ( d . day ) ;
431437 this . d . setMonth ( d . month ) ;
438+ this . d . setDate ( d . day ) ;
432439 this . mode = 'time' ;
433440 this . render ( 'fade' ) ;
434441 } else {
@@ -718,4 +725,4 @@ var DatePicker = new Class({
718725
719726 return d ;
720727 }
721- } ) ;
728+ } ) ;
0 commit comments