Можно ли привязать кнопки к Yandex Map, при нажатии на которые будет производится плавный переход между метками?
Каждая кнопка символизирует свой город.
HTML:
<script src="http://api-maps.yandex.ru/2.0/?load=package.standard&lang=ru-RU" type="text/javascript"></script>
<div id="map" style="width:100%; height:500px"></div>
<button class="city1" type="button" name="button">Город1</button>
<button class="city2" type="button" name="button">Город2</button>
<button class="city3" type="button" name="button">Город3</button>
JS:
ymaps.ready(init);
function init() {
destinations = {
'Город1': [48.424020, 135.166384],
'Город2': [62.067922, 129.703681],
'Город3': [43.145268, 131.952203]
},
myMap = new ymaps.Map('map', {
center: destinations['Город1'],
zoom: 16.7
});
result.textContent = 'map init';
function clickGoto() {
var pos = this.textContent;
result.textContent = pos;
myMap.panTo(destinations[pos], {
flying: 1
});
return false;
}
}