X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=fx%2Ffx.js;h=df59d781c24accabc42fe34eb542141ccfa87d2a;hb=2f023fdd210a509353ae634bd1cd5d2fec59b0ce;hp=bd34c3094f1c7e35da90bd573b3275699797d8b3;hpb=29a059142123a8bde16de2e579e7708a86a8de78;p=jquery.git diff --git a/fx/fx.js b/fx/fx.js index bd34c30..df59d78 100644 --- a/fx/fx.js +++ b/fx/fx.js @@ -87,7 +87,7 @@ jQuery.fn.extend({ if ( prop[p].constructor == Number ) e.custom( e.cur(), prop[p] ); else - e[ prop[p] ](); + e[ prop[p] ]( prop ); } }); }, @@ -121,12 +121,20 @@ jQuery.fn.extend({ jQuery.extend({ setAuto: function(e,p) { + if ( e.notAuto ) return; + + if ( p == "height" && e.scrollHeight != parseInt(jQuery.curCSS(e,p)) ) return; + if ( p == "width" && e.scrollWidth != parseInt(jQuery.curCSS(e,p)) ) return; + // Remember the original height var a = e.style[p]; // Figure out the size of the height right now var o = jQuery.curCSS(e,p,1); + if ( p == "height" && e.scrollHeight != o || + p == "width" && e.scrollWidth != o ) return; + // Set the height to auto e.style[p] = e.currentStyle ? "" : "auto"; @@ -134,7 +142,10 @@ jQuery.extend({ var n = jQuery.curCSS(e,p,1); // Revert back to the original size - if ( o != n && n != "auto" ) e.style[p] = a; + if ( o != n && n != "auto" ) { + e.style[p] = a; + e.notAuto = true; + } }, speed: function(s,o,i) { @@ -172,8 +183,7 @@ jQuery.extend({ // Get next function var f = elem.queue[type][0]; - if ( f ) - f.apply( elem ); + if ( f ) f.apply( elem ); } }, @@ -205,11 +215,13 @@ jQuery.extend({ if (z.now == 1) z.now = 0.9999; if (window.ActiveXObject) y.filter = "alpha(opacity=" + z.now*100 + ")"; - y.opacity = z.now; + else + y.opacity = z.now; // My hate for IE will never die } else if ( parseInt(z.now) ) - y[prop] = parseInt(z.now) + "px"; + y[prop] = parseInt(z.now) + "px"; + y.display = "block"; }; // Figure out the maximum number to run to @@ -219,7 +231,7 @@ jQuery.extend({ // Get the current size z.cur = function(){ - return parseFloat( jQuery.curCSS(z.el,prop) ) || z.max(); + return parseFloat( jQuery.curCSS(z.el, prop) ) || z.max(); }; // Start an animation from one number to another @@ -234,21 +246,17 @@ jQuery.extend({ }; // Simple 'show' function - z.show = function(){ + z.show = function( p ){ if ( !z.el.orig ) z.el.orig = {}; // Remember where we started, so that we can go back to it later z.el.orig[prop] = this.cur(); - if ( !y[prop] ) z.o.auto = true; - - z.custom(0,z.max()); + z.custom( 0, z.el.orig[prop] ); // Stupid IE, look what you made me do if ( prop != "opacity" ) y[prop] = "1px"; - - y.display = "block"; }; // Simple 'hide' function @@ -266,13 +274,15 @@ jQuery.extend({ // IE has trouble with opacity if it does not have layout if ( jQuery.browser.msie && !z.el.currentStyle.hasLayout ) - y.zoom = 1; + y.zoom = "1"; // Remember the overflow of the element - z.oldOverflow = y.overflow; + if ( !z.el.oldOverlay ) + z.el.oldOverflow = jQuery.css( z.el, "overflow" ); // Make sure that nothing sneaks out - y.overflow = "hidden"; + if ( z.el.oldOverlay == "visible" ) + y.overflow = "hidden"; // Each step of an animation z.step = function(firstNum, lastNum){ @@ -290,7 +300,7 @@ jQuery.extend({ if ( z.o.hide ) y.display = 'none'; // Reset the overflow - y.overflow = z.oldOverflow; + y.overflow = z.el.oldOverflow; // If a callback was provided, execute it if( z.o.complete && z.o.complete.constructor == Function ) @@ -299,7 +309,8 @@ jQuery.extend({ // Reset the property, if the item has been hidden if ( z.o.hide ) - y[ prop ] = z.el.orig[ prop ].constructor == Number && prop != "opacity" ? z.el.orig[prop] + "px" : z.el.orig[prop]; + y[ prop ] = z.el.orig[ prop ].constructor == Number && prop != "opacity" ? + z.el.orig[prop] + "px" : z.el.orig[prop]; // set its height and/or width to auto jQuery.setAuto( z.el, prop );