Last active
September 3, 2016 12:07
-
-
Save alexvas123/2c229c954bf9da2d650268b9f4fbaf92 to your computer and use it in GitHub Desktop.
Page Scroll to ID
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
// jQuery | |
$("a[href^='#section']").on('click', function (event) { | |
var target = $(this.getAttribute('href')); | |
if (target.length) { | |
event.preventDefault(); | |
$('html, body').stop().animate({ | |
scrollTop: target.offset().top | |
}, 1000); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment