- How to shrink a navigation bar when the user starts to scroll the page?
- How do I change the active links in scrolling?
How to shrink a navigation bar when the user starts to scroll the page?
By using JavaScript you can easily make the navigation bar shrinkable when the user scrolls down. Creating Structure: In this section, we will create a basic website structure for the shrinkable navbar and when the user scrolls down the page it will display the effect.
How do I change the active links in scrolling?
to change the link style we can simply add a active to the classList of link. All this is done every time the page is scrolled. window. onscroll = () => var current = ""; sections.