I
I
Ilya Belsky2016-04-23 16:27:32
Yandex maps
Ilya Belsky, 2016-04-23 16:27:32

How to insert an image into the balloon?

Good day! Can you tell me how to insert an image into the balloon?
Here is the js code:

ymaps.ready(init);
function init () {
    var myMap = new ymaps.Map('map', {
            center: [59.850097, 30.271213],
            zoom: 12
        }, {
            searchControlProvider: 'yandex#search'
        }),

    objectManager = new ymaps.ObjectManager({
        clusterize: true,
        gridSize: 32
    });
    
    objectManager.objects.options.set({
        iconLayout: 'default#image',
        iconImageHref: './img/playground.png'
    });
    objectManager.clusters.options.set('preset', 'islands#greenClusterIcons');
    myMap.geoObjects.add(objectManager);
    

    $.ajax({
        url: "./json/data.json"
    }).done(function(data) {
        objectManager.add(data);
    });
}

and data.json
{
  "type": "FeatureCollection",
  "features": [
    {"type": "Feature", "id": 0, "geometry": {"type": "Point", "coordinates":  [59.850692, 30.257390]}, "properties": {"balloonContent": "Содержимое балуна", "clusterCaption": "Еще одна метка", "hintContent": "Текст подсказки"}}
  ]
}

I shortened data.json to make it easier.
I do not understand at all from what end to take on these pictures. So I know how to insert, but I have no idea with json.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
forgotten, 2016-04-25
@forgotten

You can specify arbitrary html in the balloonContent field

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question