Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【BUG】pageScrollTo方法在h5可能造成页面卡顿 #285

Open
Xuew2020 opened this issue Nov 22, 2022 · 0 comments
Open

【BUG】pageScrollTo方法在h5可能造成页面卡顿 #285

Xuew2020 opened this issue Nov 22, 2022 · 0 comments

Comments

@Xuew2020
Copy link

Xuew2020 commented Nov 22, 2022

image
Element.scrollTop接受的是一个整数,如果赋值带有小数,会截取整数部分,如下图
image

造成卡顿的原因:
当speed是一个比较小的值时,nextTop得出的结果与top绝对值小于1,此时设置rootElement.scrollTop后实际没变化,极端情况会在同一个值循环,导致页面卡顿。

另外,同一个元素多次触发pageScrollTo方法时是否应该先清除上一次的requestAnimationFrame?

@Xuew2020 Xuew2020 changed the title pageScrollTo在h5可能造成页面卡顿 【BUG】pageScrollTo方法在h5可能造成页面卡顿 Nov 22, 2022
Xuew2020 added a commit to Xuew2020/universal-api that referenced this issue Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant