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

Sticky header/footer for non-body scroll elements. #96

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Danielku15
Copy link

This PR implements the feature requested in #80. When the corresponding new "relative mode" is enabled via setting the header is positioned within the next parent scrollable element.

@DataTables
Copy link
Collaborator

Awesome - thanks for this! Any chance of adding an example for it? Also to confirm, this is one level of relative scrolling? It wouldn't work nested inside two or more scrolling containers. I think that's a fairly unlikely use case, in fairness, but I just want to confirm that wasn't a goal here.

One other thing, are you happy for this to be included under the MIT license?

@Danielku15
Copy link
Author

I would have to check how it behaves if you have nested scroll elements. It listens globally for all scroll events on all elements (capture event). The position calculation works then relatively to the parent. It could work since I also check if the scroll parent is visible and positioning is happening absolute. But there might be cases where this does not work out. I'll try to prepare a small sample in JSFiddle.

@Danielku15
Copy link
Author

Danielku15 commented Aug 14, 2017

Sample 1: Simple usage (Header Only)
https://jsfiddle.net/ndd45j47/1/

Sample 2: Footer and Header
https://jsfiddle.net/f2wtd6tn/1/

I also tried the nested behavior but it might not be fully as expected for some use cases. The header sticks to the top of the inner scroll window, it does not take any outer scroll into account. It's not directly wrong and would definitly need a setting to switch between the behaviors: https://jsfiddle.net/f2wtd6tn/2/

I also needed to make some fixes, I was accidentally using a jQuery UI specific function that was available in our application. I pulled a copy of the function with slight adjustments.

PS: Yes, I feel fine with including this under MIT in this library.

@jdano1092
Copy link

jdano1092 commented Apr 24, 2018

When do you think this will become available? If not already. The examples look great.

@CarlChilton
Copy link

CarlChilton commented Apr 10, 2019

Hi all, was this published? I'm experiencing the same issues and the examples look perfect for my purposes. Best wishes.

@DataTables
Copy link
Collaborator

Not yet. Still on my (extensive) backlog I'm afraid.

@viicslen
Copy link

Hello, any news on this commit?

@CarlChilton
Copy link

I found a workaround, which is to disable data tables fixed header and use CSS to set the elements to position sticky with a top of 0. Works perfectly.

@alveri
Copy link

alveri commented Feb 25, 2021

Hi. Any news on it?

@DataTables
Copy link
Collaborator

No sorry. This issue will be updated when I've been able to make time to dig into this.

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

Successfully merging this pull request may close these issues.

6 participants