sticky-kit
sticky-kit copied to clipboard
unstick not called if element is origianlly flush with top of page
I have my menu bar that is the first element within the body and flush with the top of the viewport. Scrolling down the page activates the sticky But scrolling back up to the top does not unstick the element.
Usually this wouldn't be a problem as the element is exactly where it would be (except fixed) but i have some other behaviour that relies on the unstick element to change the position and size of other elements.
I can hack fix the issue by giving the body a 1px top margin.
Note: Safari's elastic scrolling strangely fixes the issue. I would wager because Safari can report scroll values in the negative.
I'm also seeing this issue. I would love to see this debugged in the script, rather than having to hack around it in the design.
So far my simple fix is to move it 1px from the top of the screen and mask the gap with box shadow. This then triggers normal behaviour. Depends on design though #accidentalflatdesignwin. Is your solution similar?
#117 confirmed works. Such a simple patch. @leafo is there a known downside to it?
@leafo could you please merge #117?
Same problem, #117 fixes it for me.