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

是否考虑新增一个useStickyFixed(),用于获取当前元素是否处于吸顶状态? #2679

Open
admin-zlj opened this issue Nov 25, 2024 · 4 comments

Comments

@admin-zlj
Copy link

admin-zlj commented Nov 25, 2024

当元素处于吸顶状态,会处理一些样式或逻辑,这种场景还是很多的;
类似这种

const isFixed = useStickyFixed({ref:domRef});
@admin-zlj admin-zlj changed the title 是否考虑新增一个useSticky,用于获取当前元素是否处于吸顶状态? 是否考虑新增一个useStickyFixed,用于获取当前元素是否处于吸顶状态? Dec 4, 2024
@admin-zlj admin-zlj changed the title 是否考虑新增一个useStickyFixed,用于获取当前元素是否处于吸顶状态? 是否考虑新增一个useStickyFixed(),用于获取当前元素是否处于吸顶状态? Dec 4, 2024
@crazylxr
Copy link
Collaborator

crazylxr commented Dec 5, 2024

emm,这个咋判断。。。 吸顶一般不都得自己写么

@admin-zlj
Copy link
Author

emm,这个咋判断。。。 吸顶一般不都得自己写么

就是已经设置 position: sticky 元素,在外部滚动时,来判断当前设置粘性定位的元素是否处于吸顶的状态

@crazylxr
Copy link
Collaborator

crazylxr commented Dec 5, 2024

目前感觉用的场景不是特别多,先挂一阵子看看有没有人也有类似的需求

@magicdawn
Copy link

https://github.com/robinjonsson/react-use-sticky

场景: sticky 生效的时候加 style/className

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

3 participants