question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Animations with position:sticky / scroll position update

See original GitHub issue

Hi,

i’m currently trying to add sticky headers to a large list of elements. Due to position: sticky the animations get broken / look weird. Is there a workaround to handle these kinds of elements? Maybe by setting the position temporarily to relative during the animation phase?

And another question regarding the scroll position: I use react-flip-move to sort “favorite” items to the top of a list. Sometimes (but only sometimes) the scroll position is updated accordingly and “follow” the clicked item. Is there an option / fix to ensure that the scroll position is always updated or do i have to manage it outside of the library? I’m willing to add it by myself if it makes sense 😄

Thanks in advance and for this nice library 👍

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
agido-freudenreichcommented, Jul 13, 2017

Hi @joshwcomeau,

quick update, also for people who have the same issue: I’ve managed it with a little (hack) function to calculate the “real” top position and set it as getPosition prop.

getPosition = node =>{
    const position = window.getComputedStyle(node).position;
    node.style.position = 'relative';
    const boundingClientRect = node.getBoundingClientRect();
    node.style.position = position;
    return boundingClientRect;
}
1reaction
agido-freudenreichcommented, May 12, 2017

Hi @joshwcomeau,

sorry for my late answer. Thanks for your help and the explanation. We’ll try to either manage it by manually stickyness or leave it out. You/PM can’t have everything 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Position Sticky Scrolling Effects | No Javascript - YouTube
CSS Position Sticky Scrolling Effects | No Javascript ; Enroll My Course : Next Level CSS Animation and Hover Effects https://www.udemy.com/ ...
Read more >
Creating sliding effects using sticky positioning | CSS-Tricks
We've covered that individual cells, and can be position: sticky. It's pretty easy to make the header of a table stick to the...
Read more >
Simple sticky/fixed header that animates on scroll
Sticky headers are headers that remain fixed to the top of the website, and are visible even when you scroll down.
Read more >
How to use scroll-linked animations the right way
When it comes to scroll-linked animations, here are two takeaway tips: use Javascript observer patterns and CSS where possible.
Read more >
Adding position:sticky to element causes jumpy behaviour on ...
When the user scrolls it should reduce the title container element to 15vh and stick it to the top of the window. I've...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found