diff options
| author | Mark Otto <[email protected]> | 2013-07-26 00:04:24 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-07-26 00:04:24 -0700 |
| commit | d604052aa5eee4f5df8298f1e3a82be408f09629 (patch) | |
| tree | ddda43d9c3f3501c47963ebbcdeaa4fe65ac7832 /js | |
| parent | c23ba4d50b462b61a79eb5a46b52dc6904e88d28 (diff) | |
| parent | 5588e14867ee5d917ec97a32329a216c3c0ed527 (diff) | |
| download | bootstrap-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.js | 10 |
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() }) + } } |
