react-scrollspy
react-scrollspy copied to clipboard
Why does the titles in the nav bar don't get highlighted ?
I have one issue and one question :
Issue: The titles in my nav bar are not being highlighted once I scroll to a specific "Section"
Question: When I tap on a specific nav bar title, the scrollspy works fine and goes to the clicked section, but my question is :
- instead of jumping right away to the clicked section, can it instead scroll down and not jump directly to the selected html section ?
@aziz-boudi4 Sorry for the late reply.
The titles in my nav bar are not being highlighted once I scroll to a specific "Section"
Could you be more specific?
instead of jumping right away to the clicked section, can it instead scroll down and not jump directly to the selected html section ?
No, at least for now. Jumping directory to the selected section is the bahavior of HTML internal link, not by JavaScript.
@makotot Thanks for replying. Let's say I have 5 sections, would it be possible to highlight the section's title in my nav bar when I'm in the appropriate section ?
- I am using a sticky div that is fixed to the top of the screen and it contains my nav bar with all the sections titles.
- Is it possible to highlight the title or change its color when the user is seeing the appropriate section.
- Example: If I'm seeing section2 on my screen, can section title become highlighted ?
@aziz-boudi4 Hmm, could you show me an example code ? or is it public on github ? I cannot reproduce it.
add the following css:
html { scroll-behavior: smooth; }