About jQuery effects - related knowledge of hiding and showing

jacklove
Release: 2018-05-08 11:44:15
Original
1146 people have browsed it

Hide, display, switch, slide, fade in and out, andanimationcan all be achieved throughjquery. 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(); });
Copy after login

Syntax:

$(selector).hide(speed,callback); $(selector).show(speed,callback);
Copy after login

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 thefunctionname 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()
Copy after login

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(); });
Copy after login

Syntax:

$(selector).toggle(speed,callback);
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!