leafo / sticky-kit

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

What is going on? Not sticking to top as scrolls, strange behaviour #167

Open ghost opened 8 years ago

ghost commented 8 years ago

Firstly, I need to say how frustrating it is that I can't even apply this to JSFiddle because there's no way I can get your JS file into it, as it's not on https, and JSFiddle won't allow me to use the GitHub version either.

Anyway, I have never been able to get this working properly, and your demonstrations give the impression it's incredibly simple. It never turns out like your examples.

I have a main content on the left, and a sidebar on the right. The sidebar I want to stick to the top as it's scrolled down, and then when the bottom of the sidebar reaches the footer, I want it to keep there and move up with the rest of the content.

Then when scrolling back up, I want everything but reversed, so it keeps to the footer until it can stick tot he top again, all the way until the top of the container.

Out of the box, if I have a long content in both main and sidebar, the sidebar does not immediately stick at the top, instead it sticks around the centre point, then as you keep scrolling it jumps all the way up as if nothing has been applied.

dientuki commented 8 years ago

I fixed that changin one line

https://github.com/leafo/sticky-kit/blob/master/dist/sticky-kit.js#L159

to

if (scroll <= top) {

ghost commented 8 years ago

When was this changed?

On Tuesday, April 26, 2016, Juan Farias notifications@github.com wrote:

I fixed that changin one line

https://github.com/leafo/sticky-kit/blob/master/dist/sticky-kit.js#L159

to

if (scroll <= top) {

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/leafo/sticky-kit/issues/167#issuecomment-214784984

Regards,

Lee Collings www.leecollings.co

dientuki commented 8 years ago

I changed in my local copy.

I changed this

if (scroll < top) {

to this

if (scroll <= top) {

smilledge commented 8 years ago

Try setting the inner_scrolling option to false.

brenew commented 8 years ago

I also have this issue. when the scrolling starts, my right column sidebar that I'm trying to stick gets wrapped with another div in position absolute, then is off screen. I find this plugin to be incredibly frustrating as well.