Bootstrap has the class called “collapse navbar-collapse” which collapses the navigation bar when the user changes the screen resolution. The java-script along-with it at the bottom of the code triggers the collapsed menu in such a way that when the user clicks the hamburger icon of the menu and navigates to the required link, it again collapses the menu after the click. The scroll event works only for scrollable elements and also for the browser window. It basically attaches a function to run which says that the navbar should collapse when a scroll event occurs, here, it being the navigation of user to different links on the navbar.
- How to add active class on click event in custom list group in Bootstrap 4 ?
- How to detect click event outside Angular component ?
- How to Set navbar active class with Bootstrap and AngularJS ?
- How to load notification alert on top right corner without click of button in bootstrap ?
- How to make Bootstrap popover appear/disappear on hover instead of click?
- How to remove focus around buttons on click?
- How to hide a div when the user clicks outside of it using jQuery?
- CSS | shape-outside Property
- How to allow access outside localhost in AngularJS ?
- Include Bootstrap in AngularJS using ng-bootstrap
- Difference between bootstrap.css and bootstrap-theme.css
- Difference Between Bootstrap 3 and Bootstrap 4
- Difference between Bootstrap 4 and Bootstrap 5
- CSS | :active Selector
- Difference between :focus and :active selector
- How to determine active route in AngularJS ?
- How to check Active Network Connections in Windows?
- How to change the background color of the active nav-item?
- HTML DOM MediaStream active Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.