garand / sticky

jQuery Plugin for Sticky Objects
Other
3.3k stars 1.06k forks source link

Make sticky element stick to bottom of wrapper when reached #182

Closed naoisegolden closed 9 years ago

naoisegolden commented 9 years ago

Checks if sticky element has reached bottom of its wrapper, and makes it stick to the bottom instead of overflowing.

The caveat is that the script checks on every scroll event if this condition happens and then always applies css styles to the element.

It's not the most elegant solution but it works, and at least is a good start.

Solves #164, #127 and maybe #106.

garand commented 9 years ago

Sure, let's merge it! #noetsting #trustotherdevelopers #versioncontrol #hashtag

naoisegolden commented 9 years ago

@garand living on the cutting edge!

joncjordan commented 9 years ago

Wouldn't it be better to make this into an option? i.e. stickToBottom = true or false? If true we can utilize the new code, if false use the old?

garand commented 9 years ago

@joncjordan Would you be willing to write up a PR?

joncjordan commented 9 years ago

I've been trying to, but I actually can't even get this functionality to work in the first place.. Am I missing something?

joncjordan commented 9 years ago

@naoisegolden can you explain how to get this to work? I have two divs:

<div class="container" style="height: 400px">
    <div id="sticky-element" style="height: 200px"></div>
</div>

With the following js

$("#sticky-element").sticky();

The sticky-element remains fixed even when scrolling past the parent. Anything I'm doing wrong? Do you have a working example?

joncjordan commented 9 years ago

jsfiddle for reference: http://jsfiddle.net/mhsk6at3/

benedfit commented 9 years ago

Great work, but I too am not quite experiencing the desired outcome, I'll submit a PR if I can come up with a solution

davshoward commented 8 years ago

This isn't working for me as it's setting the height of the parent element to the height of the child elements, meaning it never hits the bottom...

elixirgraphics commented 8 years ago

I have to add my voice to the crowd. This doesn't seem to work for me either. I've worked on trying to sort it out for quite some time and cannot seem to make this work

acegilz commented 8 years ago

any update? how to limit it?