D
D
DeniSidorenko2019-02-22 11:59:20
JavaScript
DeniSidorenko, 2019-02-22 11:59:20

How to change the coordinates of the Yandex map marker?

Tell me how to change the coordinates of the marker when clicking on the item.
Map Code

var myMap;
    var myPlacemark;

    var init = function init() {
      myMap = new ymaps.Map("map", {
        center: [55.782889, 37.725994],
        zoom: 18,
        controls: []
      });
      myMap.behaviors.disable('scrollZoom');
      var myPlacemark = new ymaps.Placemark([55.782636, 37.726417], {}, {
        iconLayout: 'default#image',
    
      });
      myMap.geoObjects.add(myPlacemark);
    };

    ymaps.ready(init);

Something like is required
$('.contacts .tab').on('click',function(){
   

    // Contacts Lat and Log

    
    lat = 55.782889;
    lng = 37.725994;
    myPlacemark.setCoordinates([ lat, lng]); // Это пример, он не работает



  })

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-02-22
@DeniSidorenko

myPlacemark.geometry.setCoordinates([ lat, lng ]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question