mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-10-05 01:44:18 +00:00
Class Animation: Use .attr( "class" ) instead of .attr( "className" ) and adjust the queueing logic for jQuery 1.6 compatibility. Fixes #7275 - $.effects.animateClass broken in jQuery 1.6."
This commit is contained in:
parent
cd61fb1b55
commit
60d4e0ae42
21
ui/jquery.effects.core.js
vendored
21
ui/jquery.effects.core.js
vendored
@ -234,12 +234,12 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
|
|||||||
easing = null;
|
easing = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.queue( 'fx', function() {
|
return this.queue(function() {
|
||||||
var that = $( this ),
|
var that = $( this ),
|
||||||
originalStyleAttr = that.attr( 'style' ) || ' ',
|
originalStyleAttr = that.attr( 'style' ) || ' ',
|
||||||
originalStyle = filterStyles( getElementStyles.call( this ) ),
|
originalStyle = filterStyles( getElementStyles.call( this ) ),
|
||||||
newStyle,
|
newStyle,
|
||||||
className = that.attr( 'className' );
|
className = that.attr( 'class' );
|
||||||
|
|
||||||
$.each( classAnimationActions, function(i, action) {
|
$.each( classAnimationActions, function(i, action) {
|
||||||
if ( value[ action ] ) {
|
if ( value[ action ] ) {
|
||||||
@ -247,9 +247,13 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
newStyle = filterStyles( getElementStyles.call( this ) );
|
newStyle = filterStyles( getElementStyles.call( this ) );
|
||||||
that.attr( 'className', className );
|
that.attr( 'class', className );
|
||||||
|
|
||||||
that.animate( styleDifference( originalStyle, newStyle ), duration, easing, function() {
|
that.animate( styleDifference( originalStyle, newStyle ), {
|
||||||
|
queue: false,
|
||||||
|
duration: duration,
|
||||||
|
easing: easing,
|
||||||
|
complete: function() {
|
||||||
$.each( classAnimationActions, function( i, action ) {
|
$.each( classAnimationActions, function( i, action ) {
|
||||||
if ( value[ action ] ) {
|
if ( value[ action ] ) {
|
||||||
that[ action + 'Class' ]( value[ action ] );
|
that[ action + 'Class' ]( value[ action ] );
|
||||||
@ -265,14 +269,9 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
|
|||||||
if ( callback ) {
|
if ( callback ) {
|
||||||
callback.apply( this, arguments );
|
callback.apply( this, arguments );
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
// $.animate adds a function to the end of the queue
|
|
||||||
// but we want it at the front
|
|
||||||
var queue = $.queue( this ),
|
|
||||||
anim = queue.splice( queue.length - 1, 1 )[ 0 ];
|
|
||||||
queue.splice( 1, 0, anim );
|
|
||||||
$.dequeue( this );
|
$.dequeue( this );
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user