Created
June 16, 2016 16:51
-
-
Save marcobiedermann/add0fa61b69235e409f1be4268612564 to your computer and use it in GitHub Desktop.
jQuery ScrollTo Function
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
(function($) { | |
$('.scroll-to').on('click', function(event) { | |
event.preventDefault(); | |
$('html, body').animate({ | |
scrollTop: $($.attr(this, 'href')).offset().top | |
}, 800); | |
return false; | |
}); | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment