scrollTop landing

$(document).ready(function(){ $("#menu").on("click","a", function (event) { event.preventDefault(); var id = $(this).attr('href'), top = $(id).offset().top; $('body,html').animate({scrollTop: top}, 1500); }); }); <nav id="menu"> <ul> <li><a href="#yak1">Ссылка на якорь 1</a></li> <li><a href="#yak2">Ссылка на якорь 2</a></li> <li><a href="#yak3">Ссылка на якорь 3</a></li> <li><a href="#yak4">Ссылка на якорь 4</a></li> </ul> </nav>
scrollTop landing

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.