aboutsummaryrefslogtreecommitdiffstats
path: root/src/effects.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/effects.js')
-rw-r--r--src/effects.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/effects.js b/src/effects.js
index d9e9a8b31..ad2ed3c97 100644
--- a/src/effects.js
+++ b/src/effects.js
@@ -11,7 +11,17 @@ var elemdisplay = {},
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
- ];
+ ],
+ fxNow;
+
+function clearFxNow() {
+ fxNow = undefined;
+}
+
+function createFxNow() {
+ setTimeout( clearFxNow, 0 );
+ return ( fxNow = jQuery.now() );
+}
jQuery.fn.extend({
show: function( speed, easing, callback ) {
@@ -349,7 +359,7 @@ jQuery.fx.prototype = {
var self = this,
fx = jQuery.fx;
- this.startTime = jQuery.now();
+ this.startTime = fxNow || createFxNow();
this.start = from;
this.end = to;
this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
@@ -394,7 +404,8 @@ jQuery.fx.prototype = {
// Each step of an animation
step: function( gotoEnd ) {
- var t = jQuery.now(), done = true;
+ var t = fxNow || createFxNow(),
+ done = true;
if ( gotoEnd || t >= this.options.duration + this.startTime ) {
this.now = this.end;
@@ -417,7 +428,7 @@ jQuery.fx.prototype = {
jQuery.each( [ "", "X", "Y" ], function (index, value) {
elem.style[ "overflow" + value ] = options.overflow[index];
- } );
+ });
}
// Hide the element if the "hide" operation was done