A
A
Alexander Nameless082018-12-14 16:10:25
Yandex maps
Alexander Nameless08, 2018-12-14 16:10:25

How to make a label with a caption and a hint on a Yandex map?

Hello!
It is necessary to display both a label and a hint on the Yandex.map. But for some reason, this code only gives one thing:

ymaps.ready(init);

          function init() {
  
              var myMap = new ymaps.Map('yandexMap', {
                      center: [59.9181, 30.3056], 
                      zoom: 10
                  });

        var myPlacemark = new ymaps.Placemark(
          [59.8755, 30.3955],
          { hintContent: '<b>Адрес/метро:</b> Белы Куна 21-Н,  1й этаж/ м.Международная <br> <b>Площадь:</b> 45 м <br> <b>Стоимость:</b> 70 000 р. в мес. + К/У' }, 
          { iconContent: 'Магазин (нежилой фонд)' },
          { preset: 'islands#darkGreenStretchyIcon' }
                 
        );
  
        myMap.geoObjects.add(myPlacemark);

          };

How can I make both the label and hover tooltip be signed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-12-14
@Nameless08

You pass something too many parameters to the constructor, hintContent and iconContent should be in the same object:

const myPlacemark = new ymaps.Placemark([ 59.8755, 30.3955 ], {
  hintContent: '<b>Адрес/метро:</b> Белы Куна 21-Н,  1й этаж/ м.Международная <br> <b>Площадь:</b> 45 м <br> <b>Стоимость:</b> 70 000 р. в мес. + К/У' , 
  iconContent: 'Магазин (нежилой фонд)'
}, {
  preset: 'islands#darkGreenStretchyIcon'
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question