jQuery Effects - Hide and Show
hide() and show()
With jQuery, you can use the hide() and show() methods to hide and show HTML elements:
Syntax:
$(selector).hide(speed,callback);
$(selector).show(speed,callback);
The optional speed parameter specifies hiding / Display speed, which can take the following values: "slow", "fast" or milliseconds.
The optional callback parameter is the name of the function to be executed after hiding or displaying is completed.
这是第一个
这是第二个
jQuery toggle()
With jQuery, you can use the toggle() method to toggle the hide() and show() methods.
Show hidden elements and hide displayed elements:
Syntax:
$(selector).toggle(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 name of the function executed after the toggle() method is completed.
点击一次隐藏
再点击一次显示