Smooth Scrolling

JavaScript Snippet

// Smooth Scrolling
$(‘.cf a’).on(‘click’, function(event) {
  if (this.hash !==”) {
    event.preventDefault();
    const hash = this.hash;
    $(‘html, body’).animate(
      {
        scrollTop: $(hash).offset().top
      },
      800,
      function() {
        window.location.hash = hash;
      }
    );
  }
});

HTML Nav Bar

 <nav class=’cf’>
                <ul class=’cf’>
                    <li class=”hide-on-small”>
                        <a href=”#showcase”>myTunes</a>
                    </li>
                    <li>
                        <a href=’#showcase’>Overview</a>
                    </li>
                    <li>
                        <a href=’#music’>Music</a>
                    </li>
                    <li>
                        <a href=’#video’>Video</a>
                    </li>
                    <li>
                        <a href=’#gift-cards’>Gift Cards</a>
                    </li>
                </ul>
                <a href=’#’ id=’openup’>myTunes</a>
            </nav>