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

backTop组件的target指向的对象没有缓动效果 #5564

Closed
daskyrk opened this issue Mar 30, 2017 · 3 comments
Closed

backTop组件的target指向的对象没有缓动效果 #5564

daskyrk opened this issue Mar 30, 2017 · 3 comments

Comments

@daskyrk
Copy link

daskyrk commented Mar 30, 2017

What problem does this feature solve?

项目内顶部固定,滚动的是一个指定的div元素,通过target指定该滚动元素后,由于scrollToTop方法中,currentScrollTop()获得的总是window或body的scrollTop,所以缓动函数总是返回0,导致指定的滚动元素立即回到顶部。
既然有这样一个外部接口提供target,或许对target也进行动画处理比较好。

What does the proposed API look like?

currentScrollTop(this.props.target());
// 引入target
const currentScrollTop = (target) => {
  const targetScrollTop = target && target.scrollTop;
  return targetScrollTop || window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
};
@afc163
Copy link
Member

afc163 commented Mar 30, 2017

Did you propose a bug but a feature request?

@afc163 afc163 closed this as completed in 5ba4014 Mar 30, 2017
@afc163
Copy link
Member

afc163 commented Mar 30, 2017

I think this is a bug, you should choose bug report in issue templates.

@lock
Copy link

lock bot commented May 1, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants