Alberto Grespan

jQuery scrollTo with pushState

— July 13, 2013

pushState:

$(document).ready(function() {
  $('.nav-scroller > li > a').click(function(){
    var myUri = $(this).attr('href');
      $('html,body').animate({
         scrollTop: $('#' + $(this).prop('class')).offset().top
      }, 500);
      history.pushState('', document.title, myUri);
      return false;
  });
});