sticky-kit icon indicating copy to clipboard operation
sticky-kit copied to clipboard

unstick not called if element is origianlly flush with top of page

Open mkstix6 opened this issue 9 years ago • 5 comments

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.

mkstix6 avatar Jun 24 '15 10:06 mkstix6

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.

mjcampagna avatar Jul 13 '15 06:07 mjcampagna

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?

mkstix6 avatar Jul 13 '15 06:07 mkstix6

#117 confirmed works. Such a simple patch. @leafo is there a known downside to it?

lkraav avatar Dec 28 '15 00:12 lkraav

@leafo could you please merge #117?

gpoole avatar Feb 29 '16 07:02 gpoole

Same problem, #117 fixes it for me.

tcharlss avatar Feb 06 '18 06:02 tcharlss