Answer the question
In order to leave comments, you need to log in
How to smoothly scroll the page to the desired id by going to it from another page?
Let's start. I have a menu.
<a href="#about">О нас</a>
<a href="#products">Наша продукция</a>
<a href="#portfolio">Портфолио</a>
<a href="#jobs">Вакансии</a>
<a href="#contacts">Контакты</a>
$('#topMenu a').on('click',function(){
var elementClick = $(this).attr("href"),
destination = $(elementClick).offset().top - 110; //Так как шапка на сайте фиксированная, то вычтем ее высоту!
$('html, body').animate({ scrollTop: destination }, 1100);
return false;
});
Answer the question
In order to leave comments, you need to log in
You can make the transition not through the anchor, but through the GET parameter. When going to the page and after the ready page, make a smooth transition to the element with the ID specified in the GET
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question