Answer the question
In order to leave comments, you need to log in
How to make a smooth scroll from a link in Ya.Maps to an anchor?
A page with a Yandex map compiled in the map constructor. Below the map is a description of each point on it. Each point on the map has a link to the anchor below.
The map is called via the view tag
<script type="text/javascript" charset="utf-8" async src="https://api-maps.yandex.ru/services/constructor/1.0/js/?sid=0DjJzvmy4tmRmdqwCASHpQXtV0Bd0E1m&width=100%&height=500&lang=ru_RU&sourceType=constructor&scroll=true"></script>
<script>
$(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);
});
});
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question