reactjs - react-router: change route based on scroll position of body -


i have layout fixed sidebar on left, , content on right.

the content divided sections, sections listed in sidebar.

------------------------ | #sidebar | #content  | |          |           | | -      | -       | | - b      | ...       | | - c      | ...       | |          | - b       | |          | ...       | |          | ...       | |          | - c       | |          | ...       | |          | ...       | ------------------------ 

the sidebar, being fixed, scrolls page.

my current router is:

<router history={browserhistory}>   <route path='/:category' component={app}>     <route path='/:category/:section' component={content} />   </route> </router> 

i'd make :section segment change when page scrolled header of section inside #content.

my attempt was:

componentdidupdate() {   let scrolltop = this.props.scrolltop    let activeitem = this.refs[0]   let found = _.values(this.refs).find(function(element) {     return finddomnode(element).offsettop >= scrolltop   })   browserhistory.replace('/' + this.props.category + '/' + found.props.slug) } 

but doing loop...

how can achieve result?


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -