-
StackOverflow 文档
-
jQuery 教程
-
元素可见性
-
概述
$(element).hide() // sets display: none
$(element).show() // sets display to original value
$(element).toggle() // toggles between the two
$(element).is(':visible') // returns true or false
$('element:visible') // matches all elements that are visible
$('element:hidden') // matches all elements that are hidden
$('element').fadeIn(); // display the element
$('element').fadeOut(); // hide the element
$('element').fadeIn(1000); // display the element using timer
$('element').fadeOut(1000); // hide the element using timer
// display the element using timer and a callback function
$('element').fadeIn(1000, function(){
// code to execute
});
// hide the element using timer and a callback function
$('element').fadeOut(1000, function(){
// code to execute
});