Last active
August 29, 2015 14:05
-
-
Save jtulk/71eaca2c85fb97795112 to your computer and use it in GitHub Desktop.
Smoothscroll intrapage links w/ .scroll-link class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('nav').find('a').on 'click', -> | |
that = $(this) | |
target = $(this.hash) | |
if !target.length | |
target = $('[name=' + this.hash.slice(1) +']') | |
$('html,body').animate({ | |
scrollTop: target.offset().top | |
}, 1000, -> | |
#update the url hash | |
window.location.hash = that.attr('href') | |
) | |
return false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment