header jumps out of the container when sticked
See original GitHub issueHi,
As shown below, the header jumps outside the main div when it’s sticked :
Here is the code, any idea why this happens?
` export default class Colonne extends React.Component { render() {
…
var rows = rowTags.map((indicator, index) => (
<div key={index} style={{ width: 500, overflowY:'hidden'}}>
<Sticky relative topOffset={80}>
{
({ isSticky, wasSticky, style, distanceFromTop, distanceFromBottom, calculatedHeight }) => {
return (
<div style={{ ...style, overflow: 'auto', background: '#aaa'}}>
<h2>
<span className="pull-left"><center>{indicator.label}</center></span>
</h2>
</div>
)
}
}
</Sticky>
<Paper className='box' zDepth={1}>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquet ullamcorper neque in consequat. Sed vehicula dolor in ante rutrum volutpat.</p>
</Paper>
<Paper className='box' zDepth={1}>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquet ullamcorper neque in consequat. Sed vehicula dolor in ante rutrum volutpat.</p>
</Paper>
<Paper className='box' zDepth={1}>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquet ullamcorper neque in consequat. Sed vehicula dolor in ante rutrum volutpat.</p>
</Paper>
</div>
))
return(
<div style={{ width: 500, overflowY:'hidden'}}>
<StickyContainer style={{ height: 500, overflowY: 'auto', background: '#ddd'}}>
{rows}
</StickyContainer>
</div>
)
…
} } `
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Why is the sticky header getting stuck? - Stack Overflow
I inspect your code and I think because you have two conflicting classes the .header class is position:sticky and the class .sticky is...
Read more >Position: stuck; — and a way to fix it | by Dannie Vinther
We want the headings to stick while scrolling on the document window, and we want to be able to scroll horizontally within the...
Read more >Stop Using Fixed Headers and Start Using Sticky Ones
A case for sticking with fixed header positioning involves headers that condense vertically when scrolling down the page, then expand again when ...
Read more >Dealing with overflow and position: sticky; | CSS-Tricks
Creating page content that sticks to the viewport as you scroll, something like a jump-to-anchor menu or section headings, has never been easier ......
Read more >Sticky scroll - keep containers headers visible when ... - GitHub
The parent syntax nodes should smoothly stack up or goes out of stack while scrolling. This should be tied with the current viewport...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m not able to reproduce this with
relative={true}
on the Sticky element, could somebody provide a complete reproduction? Ideally a git repo I cangit clone
,npm install
,npm start
, but a code snippet I can copy-paste would be helpful too. @dgladkov maybe? I don’t want to merge your PR (#210) without reproducing the problem myself.I think this may be to do with the container being in an element with css transform / translate applied. This changes the origin of the position: fixed coordinates to that element rather than the viewport. I am having a similar problem. Wrapping element css {transform: translate3d(54px, 0px, 0px); } placeholderClientRect => DomRect{bottom:54, height:54, left:54, right:1920, top:0, width:1866, x:54, y:0} StickyHeader jumps 54px right