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

Async elements after sticky is initialized #27

Open
radubogdan opened this issue Apr 13, 2017 · 1 comment
Open

Async elements after sticky is initialized #27

radubogdan opened this issue Apr 13, 2017 · 1 comment

Comments

@radubogdan
Copy link

Hey,

I'm having problems when I insert new elements to an initialized sticky element on Android Chrome. Looks like the resize is already calculated and it doesn't get updated after a new element gets inside the wrapper.

Any solutions on how to tackle this?

Regards

@radubogdan
Copy link
Author

radubogdan commented Apr 13, 2017

I did a hotfix for the moment. It might help you to understand my problem:

if $('.sticky').length
  StickyState.prototype.recalcHeight = ->
    @onResize()
    @render()

  window.sticky = new StickyState(document.querySelectorAll('.sticky'),
    scrollClass:
      down: 'header-scroll-down'
      up: 'header-scroll-up'
      persist: true
  )

Now I can call window.sticky.recalcHeight() whenever I change the DOM and add extra childs inside the sticky. Had to swtich to a nasty window object unfortunately 👎

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