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

Upgrading to 1.1.9 breaks due to "Cannot read property 'offsetTop' of undefined". #53

Closed
jamesofficer opened this issue Oct 28, 2019 · 6 comments
Labels
fixed Issue is fixed / resolved.

Comments

@jamesofficer
Copy link

Hey there,

We've been using StickyThings in our app for a little while, and it was working great. However with the recent upgrade from 1.1.2 to 1.1.9, I get the following error and the sticky no longer works:

Screen Shot 2019-10-28 at 4 23 35 pm

I noticed if I have the scrollContainer property set then that error disappears, however the sticky no longer works. I've put the class="scroll-container" in a bunch of places but to no avail.

Going by the documentation a scroll container shouldn't be required (it wasn't for 1.1.2)? Any help would be great. Thanks for your hard work!

@ramtennae
Copy link

ramtennae commented Oct 28, 2019

I came across this issue as well with the update.

Need to check that this.boundaryElement exists before attempting to access property this.boundaryElement.offsetTop to prevent Cannot read property 'offsetTop' of undefined error.

const reachedUpperEdge = window.pageYOffset < (this.boundaryElement.offsetTop - marginTop);

Great project!

@jamesofficer
Copy link
Author

I did manage to make it work again by setting a boundary element, however I still got the same error message. Not sure if it is because I have some *ngIf statements on some of the elements though. Hopefully we get a fix soon 🤞.

@ghost ghost added the fixed Issue is fixed / resolved. label Oct 29, 2019
@ghost ghost added this to In progress in sticky-things-issues Oct 29, 2019
@ghost
Copy link

ghost commented Oct 29, 2019

@ramtennae @yahmez00 thanks for the hint and for using our library. i've fixed the issue. will release a new version later tomorrow.

ghost pushed a commit that referenced this issue Oct 30, 2019
@ghost ghost added the review Issue probably fixed. Awaiting response. label Oct 30, 2019
@ghost ghost moved this from In progress to Review in sticky-things-issues Oct 30, 2019
@ghost
Copy link

ghost commented Oct 30, 2019

@ramtennae @yahmez00 published new version 1.2.1 - should fix the problem.

@ghost ghost closed this as completed Oct 30, 2019
@ghost ghost moved this from Review to Done in sticky-things-issues Oct 30, 2019
@ghost ghost removed the review Issue probably fixed. Awaiting response. label Oct 30, 2019
@kievsash
Copy link

1.2.1 fixed it, thanks!

@kievsash
Copy link

kievsash commented Oct 30, 2019

But now observe some other issue - marginTop works in a different way: it catches sticky header good on scroll down. But then if I scroll up - my sticky element disappear only if scroll till parent top (scrollTop ==0) but not at position when it became sticky on scroll down
sticky_issue

Pay attention when i scroll up - header disappears too late - when I have scrolled on top

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Issue is fixed / resolved.
Projects
Development

No branches or pull requests

3 participants