twbs/bootstrap — pull request #13405 by charlesbjohnson (2014-04-23 04:33:19+00:00)
Title: Affix bottom when dynamic height

Hi, again!

This builds off of #13392 to make it so that an affixed element that relies on a bottom offset behave normally when there are changes that cause the document height to fluctuate.

Before:
- [Preview](http://embed.plnkr.co/ycevC4uWnoySq1UAhyYv/preview)
- [Code](http://plnkr.co/edit/ycevC4uWnoySq1UAhyYv)

After:
- [Preview](http://embed.plnkr.co/JXNbNHrt364mps0Pkfpt/preview)
- [Code](http://plnkr.co/edit/JXNbNHrt364mps0Pkfpt)

Determining the affix state is bundled into a separate method for correctness and so that it's slightly easier to understand (you can find an outline of how I understood the logic in the README for one of my plunks). Also, an element whose affix is determined to be `'bottom'` always has its offset set (instead of just bailing out when it has been determined that the affix hasn't changed). This is so that if the document height changes that the affix-bottom element ends up in the right place when the next `checkPosition` occurs.

Please check out the demo to get a sense of what I'm talking about. Change the document height with `+` and `-` and watch how the bottom affix toggles between `affix` and `affix-bottom` on master, but not on my branch. I've also checked how these changes affect the affix used in the bootstrap docs by building them locally and it all looks good on my end.

Thanks! Any feedback is appreciated. :smile: