Skip to content

Commit

Permalink
[fixed] Affix in IE10 - scrollHeight react-bootstrap#1073
Browse files Browse the repository at this point in the history
[fixed] Affix in IE10 - scrollHeight react-bootstrap#1073

after test and build_lib

name change

delete lib for pr

[fixed] Affix in IE10 - scrollHeight react-bootstrap#1073

export getDocumentHeight
  • Loading branch information
Emmylouslak authored and taion committed Aug 24, 2015
1 parent 7bf33d2 commit 8776128
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/AffixMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const AffixMixin = {
}

DOMNode = React.findDOMNode(this);
scrollHeight = document.documentElement.offsetHeight;
scrollHeight = domUtils.getDocumentHeight();
scrollTop = window.pageYOffset;
position = domUtils.getOffset(DOMNode);

Expand Down
10 changes: 10 additions & 0 deletions src/utils/domUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -205,6 +214,7 @@ export default {
ownerDocument,
getComputedStyles,
getOffset,
getDocumentHeight,
getPosition,
getSize,
activeElement: getActiveElement,
Expand Down

0 comments on commit 8776128

Please sign in to comment.