diff --git a/js/affix.js b/js/affix.js
index daebbffdd0a9f3c0aabf8088019e2374649eca99..7f80041d5d24ec267c86a6efe7b7b7e74c124c84 100644
--- a/js/affix.js
+++ b/js/affix.js
@@ -81,7 +81,7 @@
   Affix.prototype.checkPosition = function () {
     if (!this.$element.is(':visible')) return
 
-    var scrollHeight = $(document).height()
+    var scrollHeight = $('body').height()
     var height       = this.$element.height()
     var offset       = this.options.offset
     var offsetTop    = offset.top