Skip to content
This repository has been archived by the owner on Sep 11, 2022. It is now read-only.

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

Merged
merged 2 commits into from Oct 18, 2015
Merged

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

merged 2 commits into from Oct 18, 2015

Conversation

naoisegolden
Copy link

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 added a commit that referenced this pull request Oct 18, 2015
Make sticky element stick to bottom of wrapper when reached
@garand garand merged commit 485562b into garand:master Oct 18, 2015
@garand
Copy link
Owner

garand commented Oct 18, 2015

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

@naoisegolden
Copy link
Author

@garand living on the cutting edge!

@naoisegolden naoisegolden deleted the stick-to-bottom branch October 19, 2015 08:21
@joncjordan
Copy link

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
Copy link
Owner

garand commented Oct 21, 2015

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

@joncjordan
Copy link

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
Copy link

@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
Copy link

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

@benedfit
Copy link

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
Copy link

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
Copy link

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
Copy link

acegilz commented Oct 9, 2016

any update? how to limit it?

@acegilz acegilz mentioned this pull request Oct 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants