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

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -