react-sticky-el icon indicating copy to clipboard operation
react-sticky-el copied to clipboard

"stickiness" not being activated

Open ThunderDev1 opened this issue 7 years ago • 8 comments

I tried a simple example

<Sticky>
    <div style={{background: 'red'}}>test</div>
</Sticky>

It seem to add the proper divs and styles

<div style="min-height: 20px;">
    <div class="" style="transform: translateZ(0px);">
        <div style="background: red;">test</div>
    </div>
</div>

But when I scroll nothing happens, the fixed class is not being added so my test div remains hidden. Are there any cases when this component does not work ? (like particular css in parent)

Thanks

ThunderDev1 avatar Feb 04 '18 17:02 ThunderDev1

Hi @ThunderDev1! There shouldn't be any special cases... But there is always chance for bug :) Could you please provide more information or may be create some playground?

gm0t avatar Feb 12 '18 20:02 gm0t

same issue here

seyyed-sina avatar Feb 18 '19 16:02 seyyed-sina

same issue image

flieks avatar Feb 20 '20 13:02 flieks

Having the same issue here

marharyta avatar Apr 23 '20 16:04 marharyta

hey @marharyta, could you please provide a bit more examples on how you use it and what exactly is your problem? Also, which version are you using?

gm0t avatar Apr 23 '20 22:04 gm0t

Same issue here (empty class and style=transform: translateZ(0px) on the sticky div created by react-sticky-el).

Using version 2.0.9

This was due to a layout problem, the container where my content was (including <Sticky />) had a height of 100vh, it was actually the body which was scrolling (not the container).

capi1O avatar Jul 22 '21 11:07 capi1O

@xididri did you find a solution to make it work while keeping 100vh on the container?

ggregoire avatar Oct 10 '22 15:10 ggregoire

Basically the solution in my case was to use a simpler layout. I have given you access to the project repo so you can have a look. Not sure it will apply to your case though.

(edit: You need to check issue 263 which was fixed by commit ee2dc5f84025c061b9963e279a1b7b83f5e05f20)

capi1O avatar Oct 10 '22 16:10 capi1O