]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Fixed flickering and simplified calculations 12862/head
authorSuleman Chikhalia <s.chikhalia@gmail.com>
Thu, 27 Feb 2014 08:39:46 +0000 (00:39 -0800)
committerSuleman Chikhalia <s.chikhalia@gmail.com>
Thu, 27 Feb 2014 08:39:46 +0000 (00:39 -0800)
- 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

index 05c909e16c9fa278d8c7af034b23f8d850240bdf..60613b611b16b336f768b74b9077f97b60a90541 100644 (file)
@@ -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 })
     }
   }