1.show()和hide():通过改变高度,宽度,不透明度来显示/隐藏元素。
$(function(){
$("a").hide()//通过hide方法隐藏元素
})
等价于
$(function(){
$("a").css("display","none");
})
当把元素隐藏后,可以使用show()方法将元素的display样式设置为先前的显示状态("block"或"inline"或其他除了"none"之外的值)。
$(function(){
$("a").show()//通过show方法显示元素
})
同时也可以为slow()和hide()指定时间参数,以毫秒为单位,还有几个速度关键字:slow(600毫秒),normal(400毫秒),fast(200毫秒)
$(function(){
$("a").hide("slow")//以slow的速度值隐藏元素
})
$(function(){
$("a").show(1000)//1秒显示元素
})
2.fadeIn()和fadeOut():通过改变元素的不透明度显示/隐藏元素
$(