This question shows very little by the way of effort, but just to get you started, you could use Bootstrap Scrollspy and then hide any links without the active
class.
If this doesn't meet your needs, please use this as a starting point to ask a more focused question in the future.
-
First, setup all of your section headers as list items like this:
<!-- language: lang-html -->
<div id="sidebar">
<ul class="nav">
<li><a href="#Content1">Content 1</a></li>
<li><a href="#Content2">Content 2</a></li>
<li><a href="#Content3">Content 3</a></li>
</ul>
Lorem Ipsum
</div>
-
Then add scrollspy to the page, targeting the #sidebar
you just created
<!-- language: lang-js -->
$('body').scrollspy({ target: '#sidebar' })
-
Then style all li
s as hidden, but override the active one to make it visible:
<!-- language: lang-css -->
#sidebar li { display: none; }
#sidebar li.active { display: block; }
Screenshot: