Last active
August 29, 2015 14:02
-
-
Save vishnuvp/d1be2945294f03b18ed1 to your computer and use it in GitHub Desktop.
Scroll to element on click on anchor
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.menu-link').click(function(e){ | |
e.preventDefault(); | |
var href= jQuery(this).attr("href"); | |
jQuery('html, body').animate({ | |
scrollTop: jQuery(href).offset().top - 50}, 1000); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment