From 8776128d63c3b73e18a37a5a0efeb40555f0df38 Mon Sep 17 00:00:00 2001 From: maaike Date: Mon, 27 Jul 2015 15:35:03 +0300 Subject: [PATCH] [fixed] Affix in IE10 - scrollHeight #1073 [fixed] Affix in IE10 - scrollHeight #1073 after test and build_lib name change delete lib for pr [fixed] Affix in IE10 - scrollHeight #1073 export getDocumentHeight --- src/AffixMixin.js | 2 +- src/utils/domUtils.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/AffixMixin.js b/src/AffixMixin.js index b911bad4f4..af97e131c7 100644 --- a/src/AffixMixin.js +++ b/src/AffixMixin.js @@ -38,7 +38,7 @@ const AffixMixin = { } DOMNode = React.findDOMNode(this); - scrollHeight = document.documentElement.offsetHeight; + scrollHeight = domUtils.getDocumentHeight(); scrollTop = window.pageYOffset; position = domUtils.getOffset(DOMNode); diff --git a/src/utils/domUtils.js b/src/utils/domUtils.js index 256aaf64f8..f0df13f8cf 100644 --- a/src/utils/domUtils.js +++ b/src/utils/domUtils.js @@ -78,6 +78,15 @@ function getOffset(DOMNode) { }; } +/** + * Get the height of the document + * + * @returns {documentHeight: number} + */ +function getDocumentHeight() { + return Math.max(document.documentElement.offsetHeight, document.height, document.body.scrollHeight, document.body.offsetHeight); +} + /** * Get elements position * @@ -205,6 +214,7 @@ export default { ownerDocument, getComputedStyles, getOffset, + getDocumentHeight, getPosition, getSize, activeElement: getActiveElement,