From f7c360d6206a8c5d2393215239649f9234bb600b Mon Sep 17 00:00:00 2001 From: Suleman Chikhalia Date: Thu, 27 Feb 2014 00:39:46 -0800 Subject: [PATCH] Fixed flickering and simplified calculations - Removed offending line causing a flicker to the default top state - Simplified calculation of the top offset when in the bottom state --- js/affix.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/js/affix.js b/js/affix.js index 05c909e16c..60613b611b 100644 --- a/js/affix.js +++ b/js/affix.js @@ -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) @@ -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 }) } }