<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
}
body{
height: 3000px;
}
.gotop{
width: 50px;
height: 50px;
background-color: skyblue;
position: fixed;
bottom: 50px;
right: 50px;
}
</style>
</head>
<body>
<div class="gotop"></div>
<script src="../jquery/jquery.min.js"></script>
<script>
$('.gotop').click(()=>{
$('html').animate({
scrollTop:0
},4000)
})
</script>
</body>
</html>
回到顶部
最新推荐文章于 2023-09-04 10:22:10 发布