let
map = null,
marker = null;
document.addEventListener('click', function(e) {
if (!e.target.classList.contains('contacts__address--link')) {
return;
}
e.preventDefault();
const
addressData = e.target.closest('.js-address').dataset,
coord = [ addressData.longtitude, addressData.latitude ];
if (!map) {
map = new ymaps.Map('map', {
center: coord,
zoom: 17,
});
marker = new ymaps.Placemark(coord);
map.geoObjects.add(marker);
map.behaviors.disable('scrollZoom');
} else {
map.setCenter(coord);
marker.geometry.setCoordinates(coord);
}
});