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

Make possible to calculate elemBottomBound based on next <Element> elemTopBound #46

Open
dearlordylord opened this issue Nov 25, 2015 · 1 comment

Comments

@dearlordylord
Copy link

Hey, thanks for useful lib. I wondering if you can cover such use-case: presume that I have y-'gaps' between my <Element>s on the page. If I scroll over first <Element>, it makes corresponding active. However, if I'm currently 'between' <Element>s, meaning rectBound of neither first element's on z-axis nor second element's on z-axis is inside scrollTop coordinate, _neither first or second is active.

More 'real' use case: I have elements that are at the middle of page, but I want first to be active even when I'm on top of the page so user sees that she's looking at first element of my content. By layout/css consideration I can't wrap whole my page in .

Hope this explanation makes sense.

Thanks!

@fisshy
Copy link
Owner

fisshy commented Nov 25, 2015

Hey! I'm glad you like it.

I think theres a slight possibility that you can use offset on your link element - you could calculate the distance from top to your first element and update the offset of your link element.

Another possibility could be to wrap your item inside another element and use padding to position it in the middle/remove the gaps, but I guess this is more off a hack.

Other then this - I don't know how to solve it in a nonhacky way. I will expose the APIs of spy/scrolling and it could be possible to solve it that way, but I haven't gotten the time to do that yet.

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

2 participants