jQuery基本动画效果
基本动画效果
show(spend,[callback]):显示隐藏的匹配元素
hide(spend,[callback]):隐藏显示的元素
toggle(switch):根据switch参数切换元素的可见状态(true为可见,false为隐藏)。
toggle(spend,[callback]):以优雅的动画切换所有匹配的元素可见状态
<!DOCTYPE html>
<html>
<head>
<title>php.cn</title>
<meta charset="utf-8" />
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<script>
function f1(){
//隐藏 hidden
//hide([时间参数 毫秒级][,处理函数])
$('div').hide(3000,function(){
alert('我消失了,你能看到么');
});
}
function f2(){
//显示 show
//show([时间参数 毫秒级][,处理函数])
$('div').show(3000,function(){
alert('我又回来了');
});
}
function f3(){
$('div').toggle(2000);
}
</script>
<style type="text/css">
div {width:300px; height:200px; background-color:yellow;}
</style>
</head>
<body>
<div></div>
<input type="button" value="隐藏" onclick="f1()" />
<input type="button" value="显示" onclick="f2()" />
<input type="button" value="开关" onclick="f3()" />
</body>
</html>

我又来了
终于来个能看懂的了
8年前 添加回复 0