gabergg / react-scrollable-anchor

Smooth scrolling anchors bound to URL hash
MIT License
291 stars 90 forks source link

suddenly stopped working in my project? #60

Closed luky1984 closed 5 years ago

luky1984 commented 5 years ago

It suddendly stopped working dont know why. Even the sample code doesnt work

  <div>
        <a href='#section1'> Go to section 1 </a>
        <a href='#section2'> Go to section 2 </a>
        <ScrollableAnchor id={'section1'}>
          <div> Hello World </div>
        </ScrollableAnchor>
        <ScrollableAnchor id={'section2'}>
          <div> How are you world? </div>
        </ScrollableAnchor>
      </div>

but the demos here still work?? http://gabegsell.com/anchors/

luky1984 commented 5 years ago

ok it was not this project issue but my project issue. i had absolute positioned element in relative positioned element, then i had body and html height 100% and it caused window.scrollTo() not work, thus also this code stopped working. if you have it like me, remove body and html 100% height and make the relative parent height same as absolute child height. then it will work again