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

handleResize calls methods in wrong order #62

Open
Grimmys opened this issue Dec 29, 2020 · 3 comments
Open

handleResize calls methods in wrong order #62

Grimmys opened this issue Dec 29, 2020 · 3 comments

Comments

@Grimmys
Copy link

Grimmys commented Dec 29, 2020

Hello,
I don't think this repo is still active (unfortunately... this is a really good plugin), but maybe this could help someone stucked like me :

`handleResize: function() {
var _self = this;

		_self.getItems();
		_self.setWindowHeight();

}`

Since getItems needs to know the updated window height to decide between make the elements sticky or not, I think that setWindowHeight should be called before.
So both calls should be reversed, like in the init method, to avoid having sticky elements when the window is to small.

@davist11
Copy link
Owner

CSS' position: sticky is very well supported at this point, so I'd recommend using that without relying on JS to do it for you.

@Grimmys
Copy link
Author

Grimmys commented Dec 30, 2020

Thank you for your reply.

Indeed this seems to be a better solution and I thought about it before use this library but I don't think that is really configurable for my specific behaviors, like limiting sticky content to parent container.

@davist11
Copy link
Owner

Yep, that’s exactly how position sticky works!

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