Skip to content

Commit facc86e

Browse files
committed
Add initial documentation
1 parent c9cec7a commit facc86e

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
11
react-scroll-components
22
=======================
33

4-
A set of components that react to page scrolling
4+
A set of components and mixins that react to page scrolling
5+
6+
## ScrollListenerMixin
7+
8+
This mixin provides the following states:
9+
* `scrollTop`, which represents the documents' current scroll position
10+
* `isScrolling`, wether the user is currently scrolling the document
11+
12+
You can pass the following methods to your React class:
13+
* `onPageScroll`: fired when the document is scrolling. This function gets the
14+
current scroll position passed as argument.
15+
* `onPageScrollEnd`: fired when the document's scroll position hasn't changed for
16+
300 milliseconds. This function also gets the current scroll position passed as
17+
argument. If you want to change the timeout, override your components'
18+
`endScrollTimeout`
19+
20+
## ScrollBlocker
21+
22+
A very simple component that allows you to block any mouse events during
23+
scrolling. Make sure to include ScrollBlocker.css somewhere in your CSS.
24+
25+
## Example
26+
27+
```javascript
28+
var MyComponent = React.createClass({
29+
mixins: [ScrollListenerMixin],
30+
render: function () {
31+
return (
32+
<ScrollBlocker active={this.state.isScrolling}>
33+
The current scroll position is {this.state.scrollTop}.<br />
34+
The document is currently {this.state.isScrolling ? '' : 'not'} scrolling.
35+
</ScrollBlocker>
36+
)
37+
}
38+
})
39+
```

0 commit comments

Comments
 (0)