<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style type="text/css">
div {
width: 300px;
height: 300px;
display: none;
background-color: pink;
}
</style>
<script src="./jquery.js"></script>
<script>
$(function () {
$("button:eq(0)").click(function () {
$("div").slideDown(2000,function () {
alert("动画执行完毕!");
});
})
$("button:eq(1)").click(function () {
$("div").slideUp(2000,function () {
alert("动画执行完毕!")
})
})
$("button:eq(2)").click(function () {
$("div").slideToggle(1000,function () {
alert("动画动画执行完毕!")
});
})
})
</script>
</head>
<body>
<button>滑入</button>
<button>滑出</button>
<button>切换</button>
<div></div>
</body>
</html>
jQuery案例--滑入滑出动画
最新推荐文章于 2024-05-10 09:49:12 发布