What's the problem here? When I clicked the <a href="#"><a> link in navbar the navbar redirect to top then close. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's the problem here? When I clicked the <a href="#"><a> link in navbar the navbar redirect to top then close.

But when I clicked the <a href ="#project" link in navbar it redirect to project but doesnt close the navbar? https://code.sololearn.com/W7GeEtHkcrS6/?ref=app

11th Oct 2022, 1:40 AM
Mozzie
Mozzie - avatar
2 Answers
+ 3
Bootstrap nav don't close the navbar onclick by default. You have to code it. Look at this : https://stackoverflow.com/questions/42401606/how-to-hide-collapsible-bootstrap-navbar-on-click
11th Oct 2022, 5:46 AM
Roland
Roland - avatar
+ 1
Because the # character inside the link render you to the current page you are on is like reloading the location.
11th Oct 2022, 5:05 AM
Félix Zamdamela
Félix  Zamdamela - avatar