Bootstrap 3 - Navbar collapses on click

This is an odd bug. Each time I go to a new page by clicking a link in the navbar, the navbar will collapse and add a horizontal bar for a split second.

horizontal scroll bar over top of navbar

I have dug into some of the js and I think the class .collapsing is added for that short amount of time. Here is what I found in the inspector.

enter image description here

Here is a link to the site:

From there you can click through the pages on the navbar and see the issue.

Answers 1

  • The problem is that the navbar links contain:

    data-toggle="collapse" data-target=".navbar-collapse" which was probably used to close the navbar after clicking on a link. A better solution is to use:

    data-toggle="collapse" data-target=".in" so that only the active link is targeted.

Related Articles