4

请检查这个codepen,那里描述了问题。还有一个演示。
https://codepen.io/NeXTs/pen/abBwXVw

// snippet of code required by stackoverflow to post a question
slider.addEventListener("scroll", _.debounce((e) => {
    const currentHeight = parseFloat(e.target.style["height"]);
    e.target.style["height"] = currentHeight + (flag ? 5 : -5) + "px";
    flag = !flag;
}, 50));

我已经在 Mac 和 Windows 上测试过了。

Chrome 中的相同行为(在 mac 和 windows 上)
同时其他浏览器(甚至是 webkit 上的 Safari 和 Opera)不会立即跳转到最近的快照点。

这是一个错误?
如果是这样,我可以报告它的正确位置是什么?或者我可以询问的正确位置(与 webkit 相关)是什么?

4

1 回答 1

0

“Chrome 在 M81 中的布局更改后引入了自动捕捉 ( https://web.dev/snap-after-layout/ )。”

https://bugs.chromium.org/p/chromium/issues/detail?id=1181843#c8

不幸的是,这种行为在 Chrome 中是故意的。

于 2021-09-10T13:31:56.787 回答