Closed Sumis34 closed 1 year ago
Same here...
Can you show a more complete example? As far as I could reproduce it here, it works as expected: https://play.tailwindcss.com/OFvXnCVt1a
Does a parent above have an overflow-hidden
? This will prevent position: sticky
from working unfortunately.
Can you show a more complete example? As far as I could reproduce it here, it works as expected: https://play.tailwindcss.com/OFvXnCVt1a
Does a parent above have an
overflow-hidden
? This will preventposition: sticky
from working unfortunately.
But as far as I see, you are not using the StickyBox component im using
@Sumis34 I know! But <div style="position:sticky;top:20px;">
is effectively all that StickyBox is doing if it's smaller than the viewport.
Using the tailwind playground was just the quickest way to reproduce and share something that mirrors your code above.
@danielberndt Ah Ok. I'm using pretty much what I posted. Do you think the problem is with the surrounding code instead of the StickyBox itself?
Yes I think so, position: sticky
unfortunately has some foot guns. Most notably that there may be no overflow: hidden
between the sticky container and the scroll container. I remember that applying a transform
to a parent also led to weird behaviour in the past, but I'd start with looking for parents that define an overflow
property.
Im using the code below and the offset top has no effect. Am I using it wrong?