leafo / sticky-kit

A jQuery plugin for creating smart sticky elements
http://leafo.net/sticky-kit
2.9k stars 517 forks source link

Sticky kit not working for some divs #199

Closed canpoyrazoglu closed 8 years ago

canpoyrazoglu commented 8 years ago

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.

botaylortravismathew commented 8 years ago

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 8 years ago

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