X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Ffx%2Ffx.js;h=075d1abb49280225caf6345d8316ca9d003f9d2d;hb=456f0fe5985eaad42eba456b9ff710771669607c;hp=9f767a9f404bfc4872be2bff62f3518083fee8b8;hpb=2b05e24993c48f3b9c2cb9857090dc4b218b8834;p=jquery.git diff --git a/src/fx/fx.js b/src/fx/fx.js index 9f767a9..075d1ab 100644 --- a/src/fx/fx.js +++ b/src/fx/fx.js @@ -336,7 +336,7 @@ jQuery.fn.extend({ jQuery.each( prop, function(name, val){ var e = new jQuery.fx( self, opt, name ); if ( val.constructor == Number ) - e.custom( e.cur(), val ); + e.custom( e.cur() || 0, val ); else e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); }); @@ -424,18 +424,10 @@ jQuery.extend({ timers: [], - /* - * I originally wrote fx() as a clone of moo.fx and in the process - * of making it small in size the code became illegible to sane - * people. You've been warned. - */ - fx: function( elem, options, prop ){ - var z = this; - - // The styles - var y = elem.style; + var z = this, y = elem.style, + isprop = elem[prop] != null && y[prop] == null; // Simple function for setting a style value z.a = function(){ @@ -445,7 +437,10 @@ jQuery.extend({ if ( prop == "opacity" ) jQuery.attr(y, "opacity", z.now); // Let attr handle opacity else { - y[prop] = parseInt(z.now) + "px"; + if ( isprop ) + elem[prop] = parseInt(z.now); + else + y[prop] = parseInt(z.now) + "px"; // Set display property to block for height/width animations if ( prop == "height" || prop == "width" ) @@ -460,6 +455,7 @@ jQuery.extend({ // Get the current size z.cur = function(){ + if ( isprop ) return elem[prop]; var r = parseFloat( jQuery.curCSS(elem, prop) ); return r && r > -10000 ? r : z.max(); };