Skip to content

Commit

Permalink
Fixed flickering and simplified calculations
Browse files Browse the repository at this point in the history
- Removed offending line causing a flicker to the default top state
- Simplified calculation of the top offset when in the bottom state
  • Loading branch information
sultano committed Feb 27, 2014
1 parent 1e06cdf commit f7c360d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions js/affix.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
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)
Expand Down Expand Up @@ -84,7 +82,7 @@
.trigger($.Event(affixType.replace('affix', 'affixed')))

if (affix == 'bottom') {
this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
this.$element.offset({ top: position.top })
}
}

Expand Down

0 comments on commit f7c360d

Please sign in to comment.