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() { componentDidMount() {
this.scrollEvent = rcUtil.Dom.addEventListener(window, 'scroll', this.handleScroll); this.scrollEvent = rcUtil.Dom.addEventListener(window, 'scroll', this.handleScroll);
this.resizeEvent = rcUtil.Dom.addEventListener(window, 'resize', this.handleScroll);
}, },
componentWillUnmount() { componentWillUnmount() {
if (this.scrollEvent) { if (this.scrollEvent) {
this.scrollEvent.remove(); this.scrollEvent.remove();
} }
if (this.resizeEvent) {
this.resizeEvent.remove();
}
}, },
render() { render() {
@ -96,4 +100,3 @@ var Affix = React.createClass({
}); });
module.exports = Affix; module.exports = Affix;

Loading…
Cancel
Save