Url hash is changing, but viewport not scrolled
See original GitHub issueHi. I have 15 React and 3 React Router. Do you supported it?
"react": "^15.4.2",
"react-router": "^3.0.2",
I have this markup:
<ul className="links">
<li>
<a href="#link1">
Link 1
</a>
</li>
<li>
<a href="#link2">
Link 2
</a>
</li>
<li>
<a href="#link3">
Link 3
</a>
</li>
<li>
<a href="#link4">
Link 4
</a>
</li>
<li>
<a href="#link5">
Link 5
</a>
</li>
</ul>
<ScrollableAnchor id={"link1"}>
<div>
.......
</div>
</ScrollableAnchor>
So it’s not working. No errors in console. Url hash is changing, but viewport not scrolled
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Modifying location.hash without page scrolling - Stack Overflow
Use history.replaceState or history.pushState * to change the hash. This will not trigger the jump to the associated element.
Read more >Hash Tag Links That Don't Headbutt The Browser Window
The browser window will scroll itself (instantly) into such a position where the element with the ID of “section-two” is visible. It scrolls...
Read more >How to Enable Smooth Scrolling to Hash Link for One-Page ...
Enable smooth scrolling to hash links from Manage ⪧ Settings ⪧ Global Styles ⪧ Scripts.Join our Facebook group for community support: ...
Read more >Flickity · Options
It already is included with flickity.pkgd.js , but not with Flickity as a stand-alone package. ... View CodePen in debug mode to see...
Read more >React Scroll Full Page
Structural changes of cells undergoing necrosis and apoptosis. js-scroll ... React Router Dom: Scroll To Top on Route Change. com/fullPage/ ), but it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have ended up with my own solution:
Also, for supporting smooth-scroll in all browsers I have added a polyfill.
UPDATE:
You can also use Jump.js and refactor the previous component to this new one:
I had the same problem. Do you have a fixed navigation and the content is overlapped, so it isn’t visible - but shown under the navbar?
This worked for me:
import { configureAnchors } from 'react-scrollable-anchor'; configureAnchors({ offset: -64 });