I've built documentation using Bootstrap doc's CSS and JavaScript. Below is the code of sidebar in my documentation:
<div class="col-md-3 docs">
<div class="bs-docs-sidebar">
<ul class="nav docs-sidebar-nav">
<li class="active">
<a href="#one">One</a>
</li>
<li>
<a href="#two">Two</a>
</li>
</ul>
</div>
</div>
And below is the jquery code of .affix
:
$(document).ready(function () {
$('.bs-docs-sidebar').affix({ offset: { top: 290 } })
})
When I open my page it does not display the sidebar with entries One, Two. When I scroll the page, the sidebar shows "Two" as active but never shows entry "One".
I am using Bootstrap v3.2.0. Why is the sidebar not working properly with .affix
. I even tried out with data-spy=affix
but it didn't work.
How do I make sidebar work properly with affix?