Skip to content

Commit

Permalink
Fixed story page
Browse files Browse the repository at this point in the history
  • Loading branch information
thepont committed Feb 10, 2016
1 parent fd6ce05 commit f4face9
Show file tree
Hide file tree
Showing 2 changed files with 38,510 additions and 19 deletions.
54 changes: 38 additions & 16 deletions src/scroller/client/components/Story.jsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,51 @@
import React from 'react';

// export const Story = React.createClass({
// getInitialState: function() {
// return {scrollY: 0};
// },
// handleScroll: () => {
// console.log('hello', window.scrollY)
// this.setState({
// scrollY:0
// })
// },
// componentDidMount: () => {
// window.addEventListener('scroll', this.handleScroll);
// },
// render() {
// var style = {
// height: this.props.height
// }
// return <div style={style}>Hello {this.state.scrollY}</div>;
// }
// });
export class Story extends React.Component {
constructor(props) {
super(props);

//console.log(props);
//
this.state = {
scrollX:0,
props: props
}
var style = {
height: props.height
}
this.state={scrollY:0};
this.handleScroll = this.handleScroll.bind(this)
console.log(props);
}
handleScroll(){
var node = this.getDOMNode();
this.state = {
... this.state,
scrollX:node.scrollTop
};
console.log(window.scrollY);
this.setState({
scrollY:window.scrollY
});
}
componentDidMount(){
window.addEventListener('scroll', this.handleScroll);
}
render() {
return <div style={height: height} >Hello {this.state.scrollX}</div>;
var style = {
height: this.props.height
}
var fixedStyle = {
position: 'fixed'
}
return (
<div style={style} >
<div style={fixedStyle}> Hello {this.state.scrollY}</div>
</div>)
}
}
Loading

0 comments on commit f4face9

Please sign in to comment.