X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Ffx%2Ffx.js;h=7c2218e143487aa00f1695ed7a3e59390014841a;hb=7cc550727c4e0bcd93c5d435f0799f568fc74dfa;hp=30838956e1bea91690505214d0247dbf136c38bc;hpb=044d47a504b73b66518852374e04024d22a75662;p=jquery.git diff --git a/src/fx/fx.js b/src/fx/fx.js index 3083895..7c2218e 100644 --- a/src/fx/fx.js +++ b/src/fx/fx.js @@ -305,14 +305,6 @@ jQuery.fn.extend({ * left: 50, opacity: 'show' * }, 500); * - * @test stop(); - * var hash = {opacity: 'show'}; - * var hashCopy = $.extend({}, hash); - * $('#foo').animate(hash, 'fast', function() { - * ok( hash.opacity == hashCopy.opacity, 'Check if animate changed the hash parameter' ); - * start(); - * }); - * * @name animate * @type jQuery * @param Hash params A set of style attributes that you wish to animate, and to what end. @@ -422,6 +414,13 @@ jQuery.extend({ // The styles var y = z.el.style; + + // Store display property + var oldDisplay = jQuery.css(z.el, 'display'); + // Set display property to block for animation + y.display = "block"; + // Make sure that nothing sneaks out + y.overflow = "hidden"; // Simple function for setting a style value z.a = function(){ @@ -432,8 +431,6 @@ jQuery.extend({ jQuery.attr(y, "opacity", z.now); // Let attr handle opacity else if ( parseInt(z.now) ) // My hate for IE will never die y[prop] = parseInt(z.now) + "px"; - - y.display = "block"; }; // Figure out the maximum number to run to @@ -488,9 +485,6 @@ jQuery.extend({ z.custom(z.el.orig[prop], 0); }; - // Make sure that nothing sneaks out - y.overflow = "hidden"; - // Each step of an animation z.step = function(firstNum, lastNum){ var t = (new Date()).getTime(); @@ -513,13 +507,15 @@ jQuery.extend({ if ( done ) { // Reset the overflow y.overflow = ''; + + // Reset the display + y.display = oldDisplay; + if (jQuery.css(z.el, 'display') == 'none') + y.display = 'block'; // Hide the element if the "hide" operation was done if ( z.o.hide ) y.display = 'none'; - // Otherwise reset the display property - else if ( z.o.show ) - y.display = ''; // Reset the properties, if the item has been hidden or shown if ( z.o.hide || z.o.show )