<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title></title>
<style>
select{
width:100%;
height: 30px;
}
p {
color: red;
display: none;
}
</style>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
<h2>fadeIn</h2>
<p>测试文字淡出效果</p>
<p>慕课网,专注分享</p>
选择:淡出的隐藏效果
</br>
</br>
<select id="animation">
<option value="1">fadeIn( )</option>
<option value="2">fadeIn( "slow" )</option>
<option value="3">fadeIn( 3000 )</option>
<option value="4">fadeIn( 2000, complete )</option>
<option value="5">fadeIn( 1000, "linear" )</option>
<option value="6">fadeIn( options )</option>
</select>
</br></br>
<input id="btnFadeIn" type="button" value="执行淡出效果" />
<input id="btnHide" type="button" value="点击隐藏" />
<script type="text/javascript">
//【显示】按钮
$("#btnFadeIn").click(function() {
var v = $("#animation").val();
if (v == "1") {
$("p").fadeIn();
} else if (v == "2") {
$("p").fadeIn("slow");
} else if (v == "3") {
$("p").fadeIn(3000);
} else if (v == "4") {
$("p").fadeIn(2000, function() {
alert("显示完毕!");
});
} else if (v == "5") {
$("p").fadeIn(1000, "linear");
} else if (v == "6") {
$("p").fadeIn({
duration: 1000
});
}
});
// 【隐藏】按钮
$("#btnHide").click(function() {
$("p").hide();
});
</script>
</body>
</html>