]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Merge pull request #11722 from DocX/patch-1
authorJacob <jacobthornton@gmail.com>
Wed, 25 Dec 2013 00:43:24 +0000 (16:43 -0800)
committerJacob <jacobthornton@gmail.com>
Wed, 25 Dec 2013 00:43:24 +0000 (16:43 -0800)
Use document scroll height instead of offset height

1  2 
js/affix.js

diff --cc js/affix.js
index 3ec487a78d901e4690e1a6dee1b9cd373c1db92c,e025e205623fb335367e871b4e92a17f1e620e94..bc11feaa8ece4fb1fb6275b8cf35ca829fe826b9
      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() })
      }
    }