Glossary

HTML

<head>
  <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.bundle.min.js" integrity="sha384-feJI7QwhOS+hwpX2zkaeJQjeiwlhOP+SdQDqhgvvo1DsjtiSQByFdThsxO669S2D" crossorigin="anonymous"></script>
  </head>
  <body>
  <div id="header" style="height: 400px; background: red;">
    <h1>
      header
    </h1>
  </div>
  <div id="wrapper">
    <!--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>
            <a href="#anchB" data-scroll>
                            <span class="fa fa-anchor solo">B</span>
                        </a>
          </li>
          <li>
            <a href="#anchC" data-scroll>
                            <span class="fa fa-anchor solo">C</span>
                        </a>
          </li>
          <li>
            <a href="#anchD" data-scroll>
                            <span class="fa fa-anchor solo">D</span>
                        </a>
          </li>
          <li>
            <a href="#anchE" data-scroll>
                            <span class="fa fa-anchor solo">E</span>
                        </a>
          </li>
          <li>
            <a href="#anchF" data-scroll>
                            <span class="fa fa-anchor solo">F</span>
                        </a>
          </li>
          <li>
            <a href="#anchG" data-scroll>
                            <span class="fa fa-anchor solo">G</span>
                        </a>
          </li>
          <li>
            <a href="#anchH" data-scroll>
                            <span class="fa fa-anchor solo">H</span>
                        </a>
          </li>
          <li>
           ...

CSS

#wrapper {
  padding-left: 250px;
  transition: all 0.4s ease 0s;
}

#sidebar-wrapper {
  margin-left: -250px;
  left: 250px;
  width: 250px;
  background: #000;
  position: fixed;
  height: 100%;
  overflow-y: auto;
  z-index: 1000;
  transition: all 0.4s ease 0s;
}

#wrapper.active {
  padding-left: 0;
}

#wrapper.active #sidebar-wrapper {
  left: 0;
}

#page-content-wrapper {
  width: 100%;
}

.selected{
  color: red;
  background: yellow;
}

.sidebar-nav {
  position: absolute;
  top: 0;
  width: 250px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav li {
  line-height: 40px;
  text-indent: 20px;
}

.sidebar-nav li a {
  color: #999999;
  display: block;
  text-decoration: none;
  padding-left: 60px;
}

.sidebar-nav li a span:before {
  position: absolute;
  left: 0;
  color: #41484c;
  text-align: center;
  width: 20px;
  line-height: 18px;
}

.sidebar-nav li a:hover,
.sidebar-nav li.active {
  color: #fff;
  background: rgba(255,255,255,0.2);
  text-decoration: none;
}

.sidebar-nav li a:active,
.sidebar-nav li a:focus {
  text-decoration: none;
}

.sidebar-nav > .sidebar-brand {
  height: 65px;
  line-height: 60px;
  font-size: 18px;
}

.sidebar-nav > .sidebar-brand a {
  color: #999999;
}

.sidebar-nav > .sidebar-brand a:hover {
  color: #fff;
  background: none;
}



.content-header {
  height: 65px;
  line-height: 65px;
}

.content-header h1 {
  margin: 0;
  margin-left: 20px;
  line-height: 65px;
  display: inline-block;
}

#menu-toggle {
    text-decoration: none;
}

.btn-menu {
  color: #000;
} 

.inset {
  padding: 20px;
}

@media (max-width:767px) {

#wrapper {
  padding-left: 0;
}

#sidebar-wrapper {
  left: 0;
}

#wrapper.active {
  position: relative;
  left: 250px;
}

#wrapper.active #sidebar-wrapper {
  left: 250px;
  width: 250px;
  transition: all 0.4s ease 0s;
}

#menu-toggle {
  display: inline-block;
}

.inset {
  padding: 15px;
}

}

JavaScript

$(document).ready(function() {
	$('ul > li').on('click', function() {
		$('ul > li > a > span').removeClass('selected');
		$(this).find('span').addClass('selected');
	});
	$(window).on('scroll', function() {
    $('.orange-title').each(function() {
        if($(window).scrollTop() >= $(this).offset().top) {
            var id = $(this).attr('id');
            $('ul > li > a > span').removeClass('selected');
            $('a[href="#'+ id +'"] > span').addClass('selected');
        }
    });
});
});