Browse Source

add resize event for affix

pull/111/head^2
sorrycc 9 years ago
parent
commit
968b640fc2
  1. 5
      components/affix/index.jsx

5
components/affix/index.jsx

@ -72,12 +72,16 @@ var Affix = React.createClass({
componentDidMount() {
this.scrollEvent = rcUtil.Dom.addEventListener(window, 'scroll', this.handleScroll);
this.resizeEvent = rcUtil.Dom.addEventListener(window, 'resize', this.handleScroll);
},
componentWillUnmount() {
if (this.scrollEvent) {
this.scrollEvent.remove();
}
if (this.resizeEvent) {
this.resizeEvent.remove();
}
},
render() {
@ -96,4 +100,3 @@ var Affix = React.createClass({
});
module.exports = Affix;

Loading…
Cancel
Save