Created
April 16, 2013 23:55
-
-
Save jessebeach/5400660 to your computer and use it in GitHub Desktop.
A simple scroll to behavior using the jQuery.scrollTo plugin.
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
| (function ($) { | |
| $(function () { | |
| var $links = $('a[href^="#"]'); | |
| $links | |
| .on('click', function (event) { | |
| var $this = $(this); | |
| var href = $this.attr('href'); | |
| $.scrollTo(href, { | |
| duration: 500, | |
| onAfter: function () { | |
| location.replace(href); | |
| }, | |
| }); | |
| event.preventDefault(); | |
| }); | |
| }); | |
| }(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment