Skip to content

Commit

Permalink
Fixes affix-top class not applying
Browse files Browse the repository at this point in the history
Use scrollTop instead of colliderTop which uses the elements
offset().top, as the offset top does not account for padding.

This issue can be replicated by using a navbar-fixed-top and applying
relevant padding to the body. (A navbar-static-top with no padding on
the body does not encounter this issue)

Fixes #15078
Closes #15154 by merging it
  • Loading branch information
Nick O'Donoghue authored and cvrebert committed Nov 18, 2014
1 parent da79ab9 commit 36b4f90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/affix.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
var colliderTop = initializing ? scrollTop : position.top
var colliderHeight = initializing ? targetHeight : height

if (offsetTop != null && colliderTop <= offsetTop) return 'top'
if (offsetTop != null && scrollTop <= offsetTop) return 'top'
if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'

return false
Expand Down

0 comments on commit 36b4f90

Please sign in to comment.