回到顶部这个功能完成的时候,回到顶部的动画效果好用了,但是在往下滑动滚动条的时候,发现滚动条不好用了,
只需要把点击事件写在外面就可以解决这个问题;
下面代码复制就可以查看效果;
<!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>
</head>
<style>
html,
body {
height: 3000px;
/* 模拟滚动条,可用来验证代码准确性;实际不需要此代码; */
}
.busi