我正在与 CSS 中的滚动快照作斗争。
有没有办法只在一个垂直方向上使用滚动捕捉?
我想让它在向下滚动时捕捉到每个部分,但在再次向上滚动时不要捕捉。是否有可能在 CSS 中或者我需要一些 .js?
html {
scroll-snap-type: y mandatory;
}
body {
margin: 0;
scroll-snap-type: y mandatory;
}
section {
font-family: sans-serif;
font-size: 12ch;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
scroll-snap-align: start;
}
<head>
<!-- MAIN STYLE -->
<link rel="stylesheet" href="style.css">
</head>
<main>
<section>
<h1>Hello!</h1>
</section>
<section>
<h1>Toodles~</h1>
</section>
<section>
<h1>Boodles~</h1>
</section>
</main>
</html>