【发布时间】:2021-08-07 13:08:47
【问题描述】:
我想应用 scroll-snap-type 但只适用于overflow-x。
我创建了一个示例。我希望在 Firefox 中具有与 Chrome 相同的行为。 (仅在 x 轴上捕捉并在 y 轴上禁用)
如果您在 Chrome 上尝试此示例 => snap 将不会应用于 y 轴。 如果您尝试使用 Firefox => snap 将应用于 y 轴
.scroller {
height: 300px;
overflow: scroll;
scroll-snap-points-y: repeat(320px);
scroll-snap-destination: 0 0;
scroll-snap-type: x mandatory;
}
.scroller section {
width: 1000px;
scroll-snap-align: start;
}
section {
min-height: 100%;
}
<article class="scroller">
<section>
<h2>Section oneSection oneSection oneSection oneSection oneSection oneSection oneSection one</h2>
</section>
<section>
<h2>Section two</h2>
</section>
<section>
<h2>Section three</h2>
</section>
</article>
【问题讨论】: