I cannot quite get the scroll spy to work properly with a vertical nav. Below you can find the code I use. For some reason, only \"Two\" gets active.
Anyone has an i
I did it like this. for data target I use the class name .navbar
<body data-spy="scroll" data-target=".navbar" data-offset="50">
<nav class="navbar navbar-default navbar-fixed-top" >
In sorting this out for myself, I've found that the element being spied upon needs to have a scroll bar.
Take a look at this Fiddle: http://jsfiddle.net/adamp/qgU6h/1/
You can either spy directly on the body element ($('body').scrollspy()
) or give your content an explicit height and force it to show a scrollbar.
(If you look at the Bootstrap documentation example, it does the fixed-height trick.)