Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a bootstrap nav link inactive

I am using a Bootstrap nav-bar for a wizard progress indicator. I want to make sure that steps of the wizard which have not been visited yet are not clickable. I would like them to appear in the nav-bar, but have them be greyed out and the links be disabled.

Can this be done in the Bootstrap nav-bar?

like image 393
Krystian Cybulski Avatar asked Mar 26 '13 22:03

Krystian Cybulski


People also ask

How do I make bootstrap navigation active?

To set an active class in your bootstrap navbar, you can use ng-controller(NavigationController) to set bootstrap navbar active class with AngularJS. To run a single controller outside ng-view. You can set class= “active” when the angular route is clicked.

How do I toggle navbar in Bootstrap?

To create a collapsible navigation bar, use a button with class="navbar-toggler", data-toggle="collapse" and data-target="#thetarget" . Then wrap the navbar content (links, etc) inside a div element with class="collapse navbar-collapse" , followed by an id that matches the data-target of the button: "thetarget".

How do I make navbar tab active on click?

To make the clicked tab active in the navigation bar, the <li> corresponding to the clicked href in index. html introduces the css of 'active' class and removes the 'active' class from the previous <li> on click.

How do I add a space between NAV links bootstrap?

As of Bootstrap 4, you can use the spacing utilities. Add for instance px-2 in the classes of the nav-item to increase the padding.


1 Answers

You can add the disabled class to the container <li>:

<ul class="nav nav-list">    <li class="disabled"><a href="index.html">...</a></li> </ul> 

However, to disallow users clicking them, you should use JavaScript to prevent this:

$(document).ready(function() {    $(".nav li.disabled a").click(function() {      return false;    }); }); 

Another way is replacing the href property with an anchor (#) temporarily.

like image 183
gustavohenke Avatar answered Sep 18 '22 02:09

gustavohenke