I can't get my navigation items to show as "active" using bootstrap ScrollSpy. I've included bootstrap.js (Bootstrap v4.0.0-alpha.5) and jquery.min.js (3.1.1).
I have set the data-spy and data-target in the body element as follows;
<body data-spy="scroll" data-target=".navbar">
My nav section looks as follows;
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand page-scroll" href="#page-top">Logo Here</a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse66" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse66">
<ul class="nav navbar-nav navbar-right">
<li><a class="page-scroll" href="#page-top">About</a></li>
<li><a class="page-scroll" href="#section-portfolio">Projects</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
</nav>
The links #page-top
and #section-portfolio
work fine for scrolling to the right section, but for some reason the navigation elements are not becoming "active". Any ideas?
Thanks
-- Michael
You're markup represents Bootstrap Version 3 while your using the assets (CSS and Javascript) for Version 4. They aren't interchangeable generally speaking. You'll need/want to change your markup to reflect v4 if that's what you intend to use.
v4.0.0-alpha.5 Navbar vs v3.3.7 Navbar
Working v4 Example:
Working v3 Example: