Skip to content

Instantly share code, notes, and snippets.

View martinmcwhorter's full-sized avatar

Martin McWhorter martinmcwhorter

View GitHub Profile
@martinmcwhorter
martinmcwhorter / gist:1480812
Created December 15, 2011 11:40
jQuery.smoothScroll using HTML5 history API
$("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;
});