Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
danbovey committed Jun 25, 2018
1 parent 1a64cb3 commit 0b1a5b4
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,34 @@ import InfiniteScroll from 'react-infinite-scroller';
</div>
```

### Custom parent element

You can define a custom `parentNode` element to base the scroll calulations on.

```
class InfiniteScrollOverride extends InfiniteScroll {
/**
* We are overriding the getParentElement function to use a custom element as the scrollable element
*
* @param {any} el the scroller domNode
* @returns {any} the parentNode to base the scroll calulations on
*
* @memberOf InfiniteScrollOverride
*/
getParentElement(el) {
if (this.props.scrollParent) {
return this.props.scrollParent;
}
return super.getParentElement(el);
}
render() {
return super.render();
}
}
```

## Props

| Name | Type | Default | Description|
Expand Down

0 comments on commit 0b1a5b4

Please sign in to comment.