Last active
April 11, 2016 08:22
-
-
Save alexermakov/4de7578d7e7dc384b705 to your computer and use it in GitHub Desktop.
scroll for ancors
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
$('a[href^="#"], a[href^="."]').click( function(){ | |
var scroll_el = $(this).attr('href'); | |
if ($(scroll_el).length != 0) { | |
$('html, body').animate({ scrollTop: $(scroll_el).offset().top }, 1000); | |
} | |
return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment