aboutsummaryrefslogtreecommitdiffstats
path: root/src/css.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/css.js')
-rw-r--r--src/css.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/css.js b/src/css.js
index cfd0cc88a..30d6b75d1 100644
--- a/src/css.js
+++ b/src/css.js
@@ -13,12 +13,13 @@ define( [
"./css/adjustCSS",
"./css/addGetHookIf",
"./css/support",
+ "./css/showHide",
"./core/init",
"./core/ready",
"./selector" // contains
], function( jQuery, pnum, access, rmargin, document, rcssNum, rnumnonpx, cssExpand,
- isHidden, swap, curCSS, adjustCSS, addGetHookIf, support ) {
+ isHidden, swap, curCSS, adjustCSS, addGetHookIf, support, showHide ) {
var
@@ -505,6 +506,25 @@ jQuery.fn.extend( {
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
+ },
+ show: function() {
+ return showHide( this, true );
+ },
+ hide: function() {
+ return showHide( this );
+ },
+ toggle: function( state ) {
+ if ( typeof state === "boolean" ) {
+ return state ? this.show() : this.hide();
+ }
+
+ return this.each( function() {
+ if ( isHidden( this ) ) {
+ jQuery( this ).show();
+ } else {
+ jQuery( this ).hide();
+ }
+ } );
}
} );