Skip to content

Commit

Permalink
Effects: Fixed queueing of class animations. Fixes #6748 - animateCla…
Browse files Browse the repository at this point in the history
…ss broken in 1.8.7.
  • Loading branch information
scottgonzalez committed Dec 14, 2010
1 parent 2084549 commit 6731b0e
Showing 1 changed file with 31 additions and 33 deletions.
64 changes: 31 additions & 33 deletions ui/jquery.effects.core.js
Expand Up @@ -231,43 +231,41 @@ $.effects.animateClass = function(value, duration, easing, callback) {
easing = null; easing = null;
} }


return this.each(function() { return this.queue('fx', function() {
$.queue(this, 'fx', 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('className');
$.each(classAnimationActions, function(i, action) {
if (value[action]) {
that[action + 'Class'](value[action]);
}
});
newStyle = filterStyles(getElementStyles.call(this));
that.attr('className', className);


that.animate(styleDifference(originalStyle, newStyle), duration, easing, 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]);
}
}); });
newStyle = filterStyles(getElementStyles.call(this)); // work around bug in IE by clearing the cssText before setting it
that.attr('className', className); if (typeof that.attr('style') == 'object') {

that.attr('style').cssText = '';
that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() { that.attr('style').cssText = originalStyleAttr;
$.each(classAnimationActions, function(i, action) { } else {
if (value[action]) { that[action + 'Class'](value[action]); } that.attr('style', originalStyleAttr);
}); }
// work around bug in IE by clearing the cssText before setting it if (callback) { callback.apply(this, arguments); }
if (typeof that.attr('style') == 'object') {
that.attr('style').cssText = '';
that.attr('style').cssText = originalStyleAttr;
} else {
that.attr('style', originalStyleAttr);
}
if (callback) { 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);
}); });

// $.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);
}); });
}; };


Expand Down

0 comments on commit 6731b0e

Please sign in to comment.