text: $(document).ready(function(){
    $("a").on('click', function(event) {
      if (this.hash !== "") {
        var hash = this.hash;
        $('html, body').animate({
          scrollTop: $(hash).offset().top
        }, 500, function(){
          window.location.hash = hash;
        });
      } 
    });
  });
  
  
  function onScroll(event){
      var scrollPos = $(document).scrollTop();
      $('.navbar a').each(function () {
          var currLink = $(this);
          var refElement = $(currLink.attr("href"));
          if (refElement.position().top <= scrollPos && refElement.position().top + refElement.height() > scrollPos) {
              $('.navbar ul li a').removeClass("active");
              currLink.addClass("active");
          }
          else{
              currLink.removeClass("active");
          }
      });
  }