diff --git a/README.md b/README.md index 2355dd77..8ad8a085 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ var Sticky = require('react-stickynode'); - `innerZ {Number/String}` - z-index of the sticky - `enableTransforms {Boolean}` - Enable the use of CSS3 transforms (true by default). - `activeClass {String}` - Class name to be applied to the element when the sticky state is active (`active` by default). +- `releasedClass {String}` - Class name to be applied to the element when the sticky state is released (`released` by default). - `onStateChange {Function}` - Callback for when the sticky state changes. See below. - `shouldFreeze {Function}` - Callback to indicate when the sticky plugin should freeze position and ignore scroll/resize events. See below. diff --git a/src/Sticky.jsx b/src/Sticky.jsx index 5ce95eaa..a7069f45 100644 --- a/src/Sticky.jsx +++ b/src/Sticky.jsx @@ -315,7 +315,7 @@ class Sticky extends Component { } componentDidMount () { - // Only initialize the globals if this is the first + // Only initialize the globals if this is the first // time this component type has been mounted if (!win) { win = window; @@ -376,8 +376,13 @@ class Sticky extends Component { outerStyle.height = this.state.height + 'px'; } + var outerClasses = classNames('sticky-outer-wrapper', this.props.className, { + [this.props.activeClass]: this.state.status === STATUS_FIXED, + [this.props.releasedClass]: this.state.status === STATUS_RELEASED + }) + return ( -