Answer the question
In order to leave comments, you need to log in
How to implement a smooth transition on the anchor link?
there is a menu
<ul class="menu-order">
<li>
<a href="#1">1</a>
</li>
<li>
<a href="#2">2</a>
</li>
<li>
<a href="#3">3</a>
</li>
<li>
<a href="#4">4</a>
</li>
</ul>
Answer the question
In order to leave comments, you need to log in
$(document).on('click', '.menu-order li a', function() {
var linkID = $(this).attr('href');
$('html, body').animate({
scrollTop: $(linkID).offset().top
}, 'slow');
});
HERE is a link to codepen on native, the function is for all occasions
$(".menu-order li a").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"
}, {
duration: 750,
easing: "swing"
});
return false;
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question