JQuery control element hide and display

1. JQuery Hide and Display Effect

With jQuery, you can use HIDE () and show () methods to hide and display HTML elements:

 $ ("# hide"). Click ("p"). Hide ();}); // Hide all [= "  Tag content; $ ("# show"). Click () {$ ("p"). Show ();}); // When clicking ID = "show" element, display all 

tab Content;

2, jQuery fade out effect

With jQuery, you can achieve the fade out of the elements. jQuery has the following four fade methods:

fadein ()

fadeout ()
  1. fadetoggle ()
  2. Fadeto ()
  3. // jQuery fadein () is used to fade into the hidden element; $ (selector) .fadein (speed, callback); // speted (Optional) Parameter specifies the length of the effect. It can take the value: “Slow”, “fast” or millisecond; // callback (optional) parameter is the function name executed after fading is completed; $ (“button)). Click () {$ (” # Div1 “). Fadein (); $ (” # div2 “). Fadein (” slow “); $ (” # div3 “). Fadein (3000);}); // Click
  4. When the button, the fades of different effects is “Div1, Div2, Div3” elements, respectively; // jQuery Fadeout () method is used to fade out visible elements; $ (selector) .fadeout (speed, callback); // Speed ​​(optional) parameter specifies the length of the effect. It can take the value: “Slow”, “fast” or millisecond; // callback (optional) parameter is the function name executed after fading is completed; $ (“button)). Click () {$ (” # Div1 “). Fadeout (); $ (” # div2 “). Fadeout (” slow “); $ (” # div3 “). Fadeout (3000);}); // Click
  5. button, Different The effect of the fade out of the effect is the element of “DIV1, DIV2, DIV3”; // jQuery fadetoggle () method can switch between fadein () and fadeout () method; // If the element is faded, the fadetoggle () will Add fade in the elements; // If the element is fade, fadetoggle () will add a fade effect to the element; $ (selector) .fadetoggle (speed, callback); // speed (optional) parameter specifies the time long. It can take the value: “Slow”, “fast” or millisecond; // callback (optional) parameter is the function name executed after fading is completed; $ (“button)). Click () {$ (” # Div1 “). Fadetoggle (); $ (” # div2 “). Fadetoggle (” slow “); $ (” # div3 “). Fadetoggle (3000);}; // When clicking
  6. button, different The fade out of the effect is the element of “Div1, Div2, Div3”, respectively; // jQuery Fadeto () method allows gradient to a given opacity (between 0 and 1); $ (selector) .fadeto (speted, opacity, callback); // speed (reference) parameter specifies the length of the effect. It can be taken from the lower value: “Slow”, “fast” or milliseconds; // Opacity parameters set the fade in the fade out to a given opacity (value between 0 and 1); // Callback Optional) Parameter is the function name executed after Fading is completed; $ (“Button”). Click (“# Div1”). Fadeto (“Slow”, 0.15); $ (“# Div2” ) .fadeto (“slow”, 0.4); $ (“# div3”). Fadeto (“SLOW”, 0.7);}; // Click the
button to give the opacity fade in the fade out of the idiosis Elements for “DIV1, DIV2, DIV3”;
 3, jQuery sliding effect  
slideup () slideup ()

slidEtogle ()

// jQuery slidedown () method is used to slide down the element; $ (selector) .slidedown (speed, callback); // speed (optional) parameter specified the time of the effect, it You can take the following value: “Slow”, “fast” or millisecond; // callback (optional) parameter is the function name executed after the sliding is completed; $ (“# flip”). Click () {$ (“# panel”). slidedown ();}); // When you click the ID of the ID, slide the ID to the elements of the Panel; // jQuery slideup () method is used to slide the element up ($ ( Selector. Slideup (speed, callback); // speed (optional) parameter specifies the time length of the effect, it can take the value: “Slow”, “fast” or milliseconds; // Callback (optional) parameter is sliding completion The function name (“# flip”). Click (“# panel”). SliDeup ();}; // Click the ID of the FLIP, will ID is Panel The element is slid up; // jQuery slidEtogGle () method can switch between slidEdown () and slideup () methods; // If the element slides, slidEtoggle () can slide them up; // If the element slides up Then slidEtogGle () can slide them; $ (selector) .slidetoggle (speed, callback); // speed (optional) parameter specifies the time length of the effect, it can take the following value: “Slow”, “fast” or Mixi; // Callback (optional) parameter is the function name executed after the sliding is completed; $ (“# flip”). Click (“# {$ (” # panel “). Slidetoggle ();}; / / Click the element of the ID to flip, slide the ID to the elements of Panel up or down;

    The above is all the contents of this article, and it is desirable to everyone. Learning or work can bring a certain help, and I hope to support Tumi cloud!
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment