code: function scrollSpy() {
              var scrollTop = $window.scrollTop(),
                  $anchors = $childMenu.find('a'),
                  activeIndex;
              $anchors.each(function (index) {
                  var $target = $($(this).attr('href').replace(/\./g, '\\.')),
                      offsetTop = $target.offset().top,
                      offsetBottom = offsetTop + $target.outerHeight(true);
                  if (offsetTop <= scrollTop && scrollTop < offsetBottom) {
                      activeIndex = index;
                      return false;
                  }
              });
              $childMenuItem.removeClass('kss-active');
              if (typeof activeIndex !== 'undefined') {
                  $childMenuItem.eq(activeIndex).addClass('kss-active');
              }
          }
docs: Dynamic menu activation