Skip to content

Instantly share code, notes, and snippets.

@Exellin
Last active December 7, 2016 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Exellin/bcf6b6f1e66ac72d0d69936d76e43859 to your computer and use it in GitHub Desktop.
Save Exellin/bcf6b6f1e66ac72d0d69936d76e43859 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$('.scrollable').click(function(event) {
if (window.location.pathname === "/") {
event.preventDefault();
var anchor = $(this);
var target = $(anchor.attr('href')).offset().top - 70;
$('html, body').stop().animate({scrollTop: target});
} else {
window.location = "/" + (anchor.attr('href'));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment