Hide, display, switch, slide, fade in and out, and animation can all be achieved through jquery. This article talks about jquery related operations.
jQuery hide() and show()
With jQuery, you can use the hide() and show() methods to hide and show HTML elements:
$("#hide").click(function(){ $("p").hide(); }); $("#show").click(function(){ $("p").show(); });
Syntax:
$(selector).hide(speed,callback); $(selector).show(speed,callback);
The optional speed parameter specifies the speed of hiding/showing, which can take the following values: "slow", "fast" or milliseconds.
The optional callback parameter is the functionname to be executed after hiding or displaying is completed.
The following example demonstrates the hide() method with the speed parameter:
Example
$("button").click(function(){ $("p").hide(1000);}); jQuery toggle()
With jQuery, you can use the toggle() method to toggle hide() and show() method.
Show hidden elements and hide displayed elements:
Example
$("button").click(function(){ $("p").toggle(); });
Syntax:
$(selector).toggle(speed,callback);
The optional speed parameter specifies hidden/ The displayed speed, which can take the following values: "slow", "fast", or milliseconds.
The optional callback parameter is the name of the function executed after the toggle() method is completed.
This article explains jquery related animations. For more learning materials, please pay attention to the php Chinese website to watch.
Related recommendations:
Related knowledge points about jQuery events
SQL Server-RDBMS related knowledge
Related knowledge points about SQL NULL values
The above is the detailed content of About jQuery effects - related knowledge of hiding and showing. For more information, please follow other related articles on the PHP Chinese website!