Answer the question
In order to leave comments, you need to log in
Events on Yandex.Maps
If there is one myPlacemark balloon on the page, then you can simply substitute its coordinates and, when clicked, enlarge the map with these coordinates, but I have more than one element on the map, which raises the question of how to get the coordinates of the balloon when clicking on it and substitute them here myMap.setCenter([55.790139, 37.814052],15);
Example for one balloon
var myPlacemark = new ymaps.Placemark([55.790139, 37.814052], {
balloonContent: ''
}, {
preset: 'islands#circleDotIcon',
iconColor: '#1faee9'
});
myMap.geoObjects
.add(myGeoObject)
.add(myPlacemark);
myPlacemark.events.add('click', function (e) {
myMap.setCenter([55.790139, 37.814052], 15);
});
Answer the question
In order to leave comments, you need to log in
this issue was resolved
myPlacemark.events.add('click', function (e) {
var coords = e.get('coords');
myMap.setCenter(coords, 15);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question