jQuery动画效果之fadeIn,fadeOut(淡入淡出)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>淡入淡出</title>
</head>
<body>
<div id="div1" style="height: 200px;width:200px;background-color: rebeccapurple;display:none"></div>
<input type="button" value="fadeIn" id="fadeIn">
<input type="button" value="fadeOut" id="fadeOut">
<input type="button" value="fadeTaggle" id="fadeToggle">
<input type="button" value="fadeTo" id="fadeTo">
<script src="jquery-3.4.1.js"></script>
<script>
$('#fadeIn').click(function () {
$('#div1').fadeIn(1000);
});
$('#fadeOut').click(function () {
$('#div1').fadeOut(1000);
});
$('#fadeToggle').click(function () {
$('#div1').fadeToggle(1000);
});
$('#fadeTo').click(function () {
$("#div1").fadeTo(1000,0.3);//调整透明度
});
</script>
</body>
</html>