-
Notifications
You must be signed in to change notification settings - Fork 27
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
Support for dynamic sticky element's height #14
Comments
This will be a pretty common issue for dynamic contents of the sticky element. Thanks for bringing this up! I see two possible solutions when I think about this:
Currently I'd prefer approach one, since it is more extensible even tough it moves more responsibility to the developer. This could be mitigated by providing another directive for the DomObservation. Let me think about this again, but feel free to add something to my thoughts or point out any failures in it. In genereall this would probably be simplified by the already mentioned further move to Rx. I'll try start working on that. |
I agree with the first one too, as I'd rather not using the MutationObserver, but I thought to just expose a Edit: I just realized I badly explained the use case I had in mind. |
Support for |
Hi again,
I was wondering what you think about adding support for a changing height in the sticky element - aka firing again the calculations whenever the sticky element's height change.
I have this problem with internationalization (i18n) in my app: if you have a sticky element with some text inside, and then change language, the new texts could cause the element's height to be different, which will cause the element to stick at the wrong time (at least until the window is resized, which will fire
resize$.next()
and re-trigger calculations).One way could be to cache the last height, and on scroll check whether the current height changed, and if so trigger the calculations again, otherwise just
return
. Yet, I don't like to do this check on every scroll, as it doesn't have to do anything with scrolling, but I can't figure out another way (also considering theMutationObserver
isn't well supported yet...). I also tried withAfterViewChecked
but that also gets triggered every scroll, since on scroll we check whether it has to be sticky or not.What are your thoughts on this?
The text was updated successfully, but these errors were encountered: