aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick O'Donoghue <[email protected]>2014-11-16 21:01:32 +0000
committerChris Rebert <[email protected]>2014-11-17 18:17:42 -0800
commit36b4f90f250b96390f10057ba5b1312367fafe8c (patch)
treec48e3cb2e18645a315964cb7bb432b870b5abe82
parentda79ab94889dd72c83245c376e278a4c378f84b4 (diff)
downloadbootstrap-36b4f90f250b96390f10057ba5b1312367fafe8c.tar.xz
bootstrap-36b4f90f250b96390f10057ba5b1312367fafe8c.zip
Fixes affix-top class not applying
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
-rw-r--r--js/affix.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/js/affix.js b/js/affix.js
index deea29485..04f389e2c 100644
--- a/js/affix.js
+++ b/js/affix.js
@@ -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