vendor/assets/javascripts/bootstrap/affix.js in bootstrap-sass-3.1.1.0 vs vendor/assets/javascripts/bootstrap/affix.js in bootstrap-sass-3.1.1.1
- old
+ new
@@ -53,22 +53,20 @@
var position = this.$element.offset()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
- if (this.affixed == 'top') position.top += scrollTop
-
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
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')
this.$element.trigger(e)
@@ -82,10 +80,10 @@
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger($.Event(affixType.replace('affix', 'affixed')))
if (affix == 'bottom') {
- this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
+ this.$element.offset({ top: position.top })
}
}
// AFFIX PLUGIN DEFINITION