mdbootstrap / mdb-react-ui-kit

React 18 & Bootstrap 5 & Material Design 2.0 UI KIT
https://mdbootstrap.com/docs/b5/react/
Other
1.41k stars 264 forks source link

MDBNavbar with ScrollableAnchor #66

Closed MarcelWepper closed 5 years ago

MarcelWepper commented 5 years ago

Hello, I've got a problem with my navbar navigation. I have got a working navbar, and I am trying to implement a single page application with anchors. For that I am using Scrollable Anchor. I placed the anchors on my landing page and referring them in my navbar: <MDBNavItem> <MDBNavLink to="/#hero">Home</MDBNavLink> </MDBNavItem> But when I click the item on the navbar, nothing happens. The URL changes, but it is not moving to my anchor. (example.com/#hero)

Ironically, when I am not on my landing page (example.com/contact) and I am using the anchor, it works!

Can someone help me?

Best regards

Rotarepmi commented 5 years ago

MDBNavLink is, in fact, the react router's Link component. You could implement your own link element with smooth scrolling, or try our pro component: https://mdbootstrap.com/docs/react/advanced/scroll/

Best,

Jakub

MarcelWepper commented 5 years ago

Hello Jakub,

thanks for your help. I implemented my own link element with smooth scrolling.

Best regards