[ "opacity" ]
];
-function defaultDisplay(nodeName) {
- if ( !elemdisplay[ nodeName ] ) {
- var elem = jQuery("<" + nodeName + ">").appendTo("body"),
- display = elem.css("display");
-
- elem.remove();
-
- if ( display === "none" || display === "" ) {
- display = "block";
- }
-
- elemdisplay[ nodeName ] = display;
- }
-
- return elemdisplay[ nodeName ];
-}
-
jQuery.fn.extend({
show: function( speed, easing, callback ) {
if ( speed || speed === 0 ) {
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
- if ( jQuery.css( this[i], "display" ) === "none" && this[i].style.display === "" ) {
+ if ( this[i].style.display === "" && jQuery.css( this[i], "display" ) === "none" ) {
jQuery.data(this[i], "olddisplay", defaultDisplay(this[i].nodeName));
}
}
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
- var old = jQuery.data(this[i], "olddisplay");
- if ( !old ) {
- jQuery.data( this[i], "olddisplay", jQuery.css( this[i], "display" ) );
+ var display = jQuery.css( this[i], "display" );
+
+ if ( display !== "none" ) {
+ jQuery.data( this[i], "olddisplay", display );
}
}
// animations on inline elements that are having width/height
// animated
if ( jQuery.css( this, "display" ) === "inline" &&
- jQuery.css( this, "float" ) === "none" ) {
+ jQuery.css( this, "float" ) === "none" ) {
if ( !jQuery.support.inlineBlockNeedsLayout ) {
this.style.display = "inline-block";
+
} else {
var display = defaultDisplay(this.nodeName);
// block-level elements need to be inline with layout
if ( display === "inline" ) {
this.style.display = "inline-block";
- }
- else {
+
+ } else {
this.style.display = "inline";
this.style.zoom = 1;
}
}
}
- if ( opt.overflow != null || (jQuery.support.shrinkWrapBlocks && isElement) ) {
+ if ( opt.overflow != null ) {
this.style.overflow = "hidden";
}
// We need to compute starting value
if ( unit !== "px" ) {
- self.style[ name ] = (end || 1) + unit;
+ jQuery.style( self, name, (end || 1) + unit);
start = ((end || 1) / e.cur(true)) * start;
- self.style[ name ] = start + unit;
+ jQuery.style( self, name, start + unit);
}
// If a +=/-= token was provided, we're doing a relative animation
slideUp: genFx("hide", 1),
slideToggle: genFx("toggle", 1),
fadeIn: { opacity: "show" },
- fadeOut: { opacity: "hide" }
+ fadeOut: { opacity: "hide" },
+ fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
if ( done ) {
// Reset the overflow
- if ( this.options.overflow != null && (!jQuery.support.shrinkWrapBlocks || !jQuery.css( this.elem, "hasLayout" )) ) {
- this.elem.style.overflow = this.options.overflow[0];
- this.elem.style.overflowX = this.options.overflow[1];
- this.elem.style.overflowY = this.options.overflow[2];
+ if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
+ var elem = this.elem, options = this.options;
+ jQuery.each( [ "", "X", "Y" ], function (index, value) {
+ elem.style[ "overflow" + value ] = options.overflow[index];
+ } );
}
// Hide the element if the "hide" operation was done
};
}
+function defaultDisplay( nodeName ) {
+ if ( !elemdisplay[ nodeName ] ) {
+ var elem = jQuery("<" + nodeName + ">").appendTo("body"),
+ display = elem.css("display");
+
+ elem.remove();
+
+ if ( display === "none" || display === "" ) {
+ display = "block";
+ }
+
+ elemdisplay[ nodeName ] = display;
+ }
+
+ return elemdisplay[ nodeName ];
+}
+
})( jQuery );