leafo/sticky-kit

Sticky kit not working for some divs

Closed this issue · 2 comments

Our designer has used sticky kit in a website. For some divs, it's working perfectly. I see many attributes being added when scrolled, and the div is stuck at the correct place. However, another div is not working at all. I call stick_in_parent with its selector just as I do with the working one, but nothing happens. I do not get any error at all, the object is returned from the call (regular jQuery chaining, which indicates that there is no problem with the selector or function being loaded etc.) but nothing happens when I scroll. The sticky kit is not triggered at all (even though it is triggering perfectly with the element just in the next div)

The site is a complex one and it's impossible to copy paste the whole DOM and the scripts, but if anyone has any clue about why it would fail to work, I'd try my best to attach the relevant code/HTML.

Is the element you are trying to stick by any chance change have a height grater than the browser window? I am having this same issue with this case.

edit: I am not sure if you were having the same issue as me exactly. But I was able to fix my issue by using the {recalc_every: 1} option. Hope this helps you as well.

leafo commented

Hello,

I can't help you troubleshoot unless you have a stripped down example of the problem happening. Often by doing this you may even learn what the issue is.

Thanks