Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin McWhorter martinmcwhorter

View GitHub Profile
@martinmcwhorter
martinmcwhorter / gist:1480812
Created Dec 15, 2011
jQuery.smoothScroll using HTML5 history API
View gist:1480812
$("a[data-smoothscroll], [data-smoothscroll] a").click(function() {
history.pushState({path: this.path}, '', this.href);
$.smoothScroll({scrollTarget: location.hash, offset: -65});
return false;
});
$(window).bind('popstate', function() {
$.smoothScroll({scrollTarget: location.hash, speed: 0, offset: -65});
return false;
});
You can’t perform that action at this time.