From: Jacob Date: Wed, 25 Dec 2013 00:43:24 +0000 (-0800) Subject: Merge pull request #11722 from DocX/patch-1 X-Git-Tag: v3.1.0~136^2~22^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fab6e7ea77ef838adaf78adf56c951ae6e16cdc;p=thirdparty%2Fbootstrap.git Merge pull request #11722 from DocX/patch-1 Use document scroll height instead of offset height --- 0fab6e7ea77ef838adaf78adf56c951ae6e16cdc diff --cc js/affix.js index 3ec487a78d,e025e20562..bc11feaa8e --- a/js/affix.js +++ b/js/affix.js @@@ -67,23 -67,13 +67,23 @@@ if (this.affixed === affix) return if (this.unpin) this.$element.css('top', '') + var affixType = 'affix' + (affix ? '-' + affix : '') + var e = $.Event(affixType + '.bs.affix') + + this.$element.trigger(e) + + if (e.isDefaultPrevented()) return + this.affixed = affix - this.unpin = affix == 'bottom' ? position.top - scrollTop : null + this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null - this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : '')) + this.$element + .removeClass(Affix.RESET) + .addClass(affixType) + .trigger($.Event(affixType.replace('affix', 'affixed'))) if (affix == 'bottom') { - this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() }) + this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() }) } }