Last active
October 22, 2021 07:23
-
-
Save karamanskiy/8ec5e1bac1151d7d6949b113e1c71f93 to your computer and use it in GitHub Desktop.
Скролл к элементу
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
// Скролл к элементу | |
$(".menu").on("click","a.scroll", function (e) { | |
e.preventDefault(); | |
var id = $(this).attr('href'), | |
top = $(id).offset().top; | |
$('body,html').animate({scrollTop: top}, 600); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment