0

How to create a navigation slider. To be more precice there is the standard navbar - http://getbootstrap.com/examples/offcanvas/# and three items: Home, About and Contact. The home item is set to active. How to create the slider beneath of the active item?

enter image description here

And then when I click About, the white line should move to new active element.

Andrey Langovoy
  • 795
  • 2
  • 7
  • 15

1 Answers1

1

Assuming there isn't a backend to do this for you, you'll need some javascript to manipulate the nav and update to whichever is active:

$('.menu li a').click(function(e) {
  var $this = $(this);
  if (!$this.hasClass('active')) {
    $this.addClass('active');
  }
  e.preventDefault();
});

Taken from this. Please search before asking next time.

Community
  • 1
  • 1
bryce
  • 3,022
  • 1
  • 15
  • 19