Recent Codepen issues with js/jquery/bootstrap

I recently had issues concerning jquery and codepen. Most of them i resolved myself. One of them is about smoothscrolling. It works fine in local and on github.io, but on codepen works every other tuesday … Did anyone had situations where some jquery/bootstrap/js code worked fine before, then after some time just stopped and/or acted finicky?

PS: I used this standard snippet for smoothscrolling whom you can find everywhere online:

$("#navbar a").on("click", function(event) {
    if (this.hash !== "") {
      event.preventDefault();

      hash = this.hash;

      $("html, body").animate(
        {
          scrollTop: $(hash).offset().top
        },
        800,
        function() {
          window.location.hash = hash;
        }
      );
    }
  });