We are trying to fix the navbar of the page to the top of the viewport as soon as the scroll reaches it, and also, to prevent it from going over the footer. We are trying to do it via affix (Bootstrap plugin) but it doesn't seem to sort any effect. Can you give some advice?
Here's the html of the sidebar:
<div id="sidebar-wrapper" class="affix-top" data-spy="affix-top" data-offset-top="250">
<nav id="spy">
<ul class="sidebar-nav nav">
<li>
<a href="#anchA" data-scroll>
<span class="fa fa-anchor solo selected">A</span>
</a>
</li>
<!--
… <li> elements for letters A-to-Z here
-->
</ul>
</nav>
</div>
The page is available here: https://jsfiddle.net/br6n0hma/
If I get your requirements right, you fill find the example below useful. Without all the fancy things, it shows a possible core structure of your layout.
Couple of notes:
#wrapper
got a.d-flex
class, so it is easier to position/size the sidebar and the content divs..sticky-top
on#spy
..page-content
node was extended with the.container-fluid
class to properly wrap.row
elements.<body>
itself. This allows to remove a part of your javascript. (This requires the.nav-link
classes on the links in the sidebar.)