所以我对滚动捕捉感兴趣。我试着玩了一下,但没有用。我在 chrome 和 firefox 中尝试过,都没有成功。这是我的代码,请帮忙。
* {
margin: 0;
padding: 0;
}
body {
scroll-snap-type: y mandatory;
overflow-y: scroll;
scroll-snap-points-y: repeat(100vh);
}
header {
height: 100vh;
width: 100%;
background: #ff0000;
scroll-snap-align: start;
}
div {
height: 100vh;
width: 100%;
background: blue;
scroll-snap-align: start;
}
section {
height: 100vh;
width: 100%;
background: yellow;
scroll-snap-align: start;
}
<body>
<header>
<h1>
Header
</h1>
</header>
<div>
<h1>
Div
</h1>
</div>
<section>
<h1>
Section
</h1>
</section>
</body>