aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2013-07-26 00:04:24 -0700
committerMark Otto <[email protected]>2013-07-26 00:04:24 -0700
commitd604052aa5eee4f5df8298f1e3a82be408f09629 (patch)
treeddda43d9c3f3501c47963ebbcdeaa4fe65ac7832 /js
parentc23ba4d50b462b61a79eb5a46b52dc6904e88d28 (diff)
parent5588e14867ee5d917ec97a32329a216c3c0ed527 (diff)
downloadbootstrap-d604052aa5eee4f5df8298f1e3a82be408f09629.tar.xz
bootstrap-d604052aa5eee4f5df8298f1e3a82be408f09629.zip
Merge branch '3.0.0-wip' of github.com:twitter/bootstrap into 3.0.0-wip
Diffstat (limited to 'js')
-rw-r--r--js/affix.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/js/affix.js b/js/affix.js
index 5cdaa3261..c7be96e1d 100644
--- a/js/affix.js
+++ b/js/affix.js
@@ -36,6 +36,8 @@
this.checkPosition()
}
+ Affix.RESET = 'affix affix-top affix-bottom'
+
Affix.DEFAULTS = {
offset: 0
}
@@ -53,7 +55,6 @@
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
- var reset = 'affix affix-top affix-bottom'
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top()
@@ -64,11 +65,16 @@
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
if (this.affixed === affix) return
+ if (this.unpin) this.$element.css('top', '')
this.affixed = affix
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
- this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
+ this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))
+
+ if (affix == 'bottom') {
+ this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
+ }
}