S
S
Sergey2019-04-21 00:06:23
JavaScript
Sergey, 2019-04-21 00:06:23

Why are Yandex maps displayed at the maximum scale?

5cbb85eae462e117416822.jpeg
There is a page rich in content - when you open a pop-up, this picture appears in it. On another page (almost empty in terms of content) where exactly such a map is immediately visible - everything is ok.
Should be so
5cbc0bce42c86320869502.jpeg
Scripts both there and there are registered inline.
If you make a delay through setTimeout to load the map script for 4 or more seconds, then everything is ok. If less then it works every other time (then the scale adjusts to all points, then as in the picture)
I tried to disable additional scripts of vendors - it does not help. Put async - also by zeros

ymaps.ready(init);

      function init() {
        let myMap = new ymaps.Map("distributorMap", {
          center: [55.45, 45.64],
          zoom: 5,
          controls: []
        });

        myMap.controls
          .add('zoomControl', {
          position: {
            top: 30,
            right: 30
          }
        });

        myMap.behaviors.disable('scrollZoom');

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question