angular.element($document[0].body) returns an object with matching html elements, even if there is only one. We only need the first element, not wrapped in angular jqLite.
When bodyEl was being used, bodyEl.scrollTop was evaluating to an anonymous function, which made both sticksAtPositionTop(scrolledDistance) and sticksAtPositionBottom(scrolledDistance) return false when at the top of the screen (scrolledDistance was undefined).
Connected to issue #31.
angular.element($document[0].body)
returns an object with matching html elements, even if there is only one. We only need the first element, not wrapped in angular jqLite.When
bodyEl
was being used,bodyEl.scrollTop
was evaluating to an anonymous function, which made bothsticksAtPositionTop(scrolledDistance)
andsticksAtPositionBottom(scrolledDistance)
returnfalse
when at the top of the screen (scrolledDistance wasundefined
).This fixes the Simple bottom anchored demo.