首页 > 解决方案 > scrollIntoView 行为平滑不适用于第 8 代 Ipad

问题描述

我尝试了多种解决方案来在 iPad 8th gen 上实现流畅的行为。像iscrollreact scroll自定义 polyfill 滚动一样,但行为是即时的而不是平滑的。

点击按钮:

<div className="mt-4 text-center mt-md-5 btn-hide">
 <Button className="btn-see-more btn-outline-light Event Based" size="lg" onClick={() => 
  executeScroll()}>
  {constants.SEE_MORE_BTN}
  </Button>
</div>

当我在按钮单击时调用滚动功能时,滚动行为在 Windows 上是平滑的,但是当我在 ipad 8th gen 上测试相同的滚动时,滚动行为是即时的。

 const executeScroll = () => {
    const element = document.getElementById('discoverEvents');
    if (element) {
    element.scrollIntoView({ behavior: 'smooth', block: 'start' });
    }
  };

标签: javascriptiosreactjsipadnext.js

解决方案


推荐阅读