淡入淡出显示和隐藏方式
- fadeIn( [speed], [easing],[fn])
- fadeout([speed], [easing],[fn])
- fadeToggle([ speed, [easing],[fn]])
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="js/jquery-3.4.1.min.js"></script>
<script>
function fadeIn() {
$("#showDiv").fadeIn("slow","linear")
}
function fadeoutFn() {
$("#showDiv").fadeOut("slow","swing")
}
function fadeToggleFn() {
$("#showDiv").fadeToggle("slow")
}
</script>
</head>
<body>
<input type="button" value="渐渐显示div" onclick="fadeIn()">
<input type="button" value="渐渐收起div" onclick="fadeoutFn()">
<input type="button" value="淡入淡出切换div的显示和隐藏" onclick="fadeToggleFn()">
<div id="showDiv" style="height: 200px; width:200px; background-color: pink">
div显示和隐藏
</div>
</body>
</html>