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

Non-invisible headers support? #85

Open
conor888 opened this issue Dec 3, 2024 · 0 comments
Open

Non-invisible headers support? #85

conor888 opened this issue Dec 3, 2024 · 0 comments

Comments

@conor888
Copy link

conor888 commented Dec 3, 2024

I've been loving using this package in my project! It fixes a lot of problems for me, but one thing I'm still seeking is the ability to have the entire page scroll rather than just the div with the list items.

In my project, I have a page header about 400-500px tall before the list items. I tried putting this in the <div slot="header"> slot in the Virtual List, and it works exactly how I'd like, except it throws the math off for calculating which items are currently in view. You can see this in the example I've modified here, where I've forced the "Hacker News" header to be 500px tall: https://svelte.dev/playground/8a44928ad59b4ae590d705bc0339f901?version=5.5.2

As soon as you start scrolling, items from the top of the list start disappearing even though they're in view.

I saw in #15 you mentioned the header/footer elements were designed to be used with invisible elements, but would it even be possible to add in this functionality for regular elements as well? Something like a headerHeight prop that you could bind to the header's container div with bind:offsetHeight = {headerHeight} etc. Then the computation for what elements are currently in view would take that value into account.

I think this would be a super useful feature for making more complex pages still feel like they're fully scrolling!

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