imakewebthings/jquery-waypoints — pull request #151 by heartsentwined (2013-03-28 04:35:16+00:00)
Title: Sticky shortcut: delayed height evaluation

The original shortcut added `height` to the wrapper on wrapper creation. It successfully prevented sudden "jumps" on scroll, but inadvertently locked the sticky element to initialization height. In other words, it breaks dynamic sticky element layouts, e.g.

* nav menus whose items are added dynamically
* stickies whose elements are lazily loaded via ajax
* nav bars with a form; and that form adds an error field below/above the element
* just anything that loads elements / changes height after initialization...

This PR fixes this issue, while preserving the height property to prevent jumps. It moved the `height` evaluation to the waypoint trigger itself, and sets the wrapper height to be:
* the current sticky `outerHeight` if the sticky element `shouldBeStuck`
* (nothing - hand control back to userland code) otherwise

This also handles height changes during the sticky's "stuck" phase. The main flow of the document will remain unaffected by using the "old" height, but once the sticky is back in place "unstuck", the wrapper inline height will be removed, allowing for the changed height once again. When the element then becomes sticky again, the wrapper will be set to the "new" height.

Tests pass.