Created
October 26, 2014 17:46
-
-
Save JLevstein/23ae16f4605273b1910f to your computer and use it in GitHub Desktop.
Basic scrollTo function
This file contains hidden or 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
$('.primary-nav').on('click', 'a', function(e) { | |
e.preventDefault(); | |
var target = $(this).attr('href'); | |
var destination = $(target).offset().top; | |
$('html:not(:animated),body:not(:animated)').stop().animate({ | |
scrollTop: destination - 60 | |
}, 600); | |
return true; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment