From 032e1af0376f66d3acd21380eab02269bbe74d7a Mon Sep 17 00:00:00 2001 From: codatrigger <matrix@engramstudio.com> Date: Tue, 4 Feb 2014 16:41:53 -0500 Subject: [PATCH] correct unpin offset cache/test for affix-bottom pinnedOffset is constantly & incorrectly recalculated, and unpin is incorrectly tested, if .affix has top:0px --- js/affix.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/affix.js b/js/affix.js index d447b0947e..fc76d2bfd5 100644 --- a/js/affix.js +++ b/js/affix.js @@ -34,7 +34,7 @@ } Affix.prototype.getPinnedOffset = function () { - if (this.pinnedOffset) return this.pinnedOffset + if (this.pinnedOffset !== null) return this.pinnedOffset this.$element.removeClass(Affix.RESET).addClass('affix') var scrollTop = this.$window.scrollTop() var position = this.$element.offset() @@ -66,7 +66,7 @@ offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false if (this.affixed === affix) return - if (this.unpin) this.$element.css('top', '') + if (this.unpin !== null) this.$element.css('top', '') var affixType = 'affix' + (affix ? '-' + affix : '') var e = $.Event(affixType + '.bs.affix') -- GitLab