Created by: charlesbjohnson
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:
After:
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.