Answer the question
In order to leave comments, you need to log in
How to make Yandex.Map change its size smoothly and dynamically?
Good time!
There is a block with a fixed height - map-area . The map is loaded into it, and, accordingly, it automatically takes the height of the parent block (moreover, the height is automatically written in the style attribute of the created map). I also have a button that smoothly changes the height of the map-area block . If you don't touch the map ( or set it explicitly to 100% height ), it will not react to changing the size of the container, moreover, stubs with the inscription "Yandex.maps do not have data about these coordinates" will appear around the edges. The card is broken.
Found the following workable:
$map.animate({'height':'600px'}, 'fast', 'linear', function() {
map.container.fitToViewport(); // объект класса ymaps.Map
})
Answer the question
In order to leave comments, you need to log in
Well, obviously, manually change the height of the map in a cycle and call fitToViewport.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question