Skip to content

Commit

Permalink
[build]
Browse files Browse the repository at this point in the history
  • Loading branch information
developerdizzle committed Aug 22, 2015
1 parent 06e45ae commit 010197b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dist/VirtualList.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var VirtualList = React.createClass({displayName: "VirtualList",

var offsetTop = utils.topDifference(list, container);

var viewTop = typeof container.scrollY !== 'undefined' ? container.scrollY : container.scrollTop;
var viewTop = utils.viewTop(container);

var renderStats = VirtualList.getItems(viewTop, viewHeight, offsetTop, props.itemHeight, items.length, props.itemBuffer);

Expand Down
15 changes: 15 additions & 0 deletions dist/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ function topFromWindow(element) {
return element.offsetTop + topFromWindow(element.offsetParent);
}

function viewTop(element) {
var viewTop;
if (element === window) {
viewTop = window.pageYOffset;
if (viewTop == null) viewTop = document.documentElement.scrollTop;
if (viewTop == null) viewTop = document.body.scrollTop;
}
else {
viewTop = element.scrollY;
if (viewTop == null) viewTop = element.scrollTop;
}
return (viewTop == null) ? 0 : viewTop;
}

function debounce(func, wait, immediate) {
if (!wait) return func;

Expand Down Expand Up @@ -47,5 +61,6 @@ module.exports = {
areArraysEqual: areArraysEqual,
topDifference: topDifference,
topFromWindow: topFromWindow,
viewTop: viewTop,
debounce: debounce
};

0 comments on commit 010197b

Please sign in to comment.