Created
March 27, 2014 05:21
-
-
Save dnikonov/9800861 to your computer and use it in GitHub Desktop.
JS: 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
// прокрутка на все якоря (#) на странице | |
$('a[href^="#"]').click(function(event){ | |
event.preventDefault(); | |
var h = $(this).attr('href'); | |
var to = $('a[name=' + h.substr(1) + ']'); | |
$('html, body').stop().animate({ | |
'scrollTop': to.offset().top | |
}, 250); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment