Answer the question
In order to leave comments, you need to log in
How to make a window close when a button is clicked?
ymaps.ready(function () {
var map = new ymaps.Map(
'map-pickups',
{center: [55.75, 37.64], zoom: 10, controls: ['zoomControl', 'fullscreenControl']},
{searchControlProvider: 'yandex#search'}
);
var objManager = new ymaps.ObjectManager({
clusterize: true,
gridSize: 32,
clusterDisableClickZoom: true
});
objManager.objects.options.set('preset', 'islands#blueDotIcon');
objManager.clusters.options.set('preset', 'islands#blueClusterIcons');
map.geoObjects.add(objManager);
var pickups = {
type: 'FeatureCollection',
features: []
};
var coordinates = [
[55.831903, 37.411961],
[55.763338, 37.565466],
[55.763338, 37.565466],
[55.843363, 37.778445]
];
$.each(coordinates, function (id, coordinates) {
pickups.features.push({
type: 'Feature',
id: id,
geometry: {type: 'Point', coordinates: coordinates},
properties: {
balloonContentBody: '...',
balloonContentFooter: '<a href="#" class="btn-select-pickup" data-id="'+id+'">Выбрать пункт</a>',
balloonContentHeader: 'ПВЗ №' + id,
clusterCaption: 'ПВЗ №' + id,
hintContent: 'ПВЗ №' + id
}
});
});
objManager.add(pickups);
map.setBounds(map.geoObjects.getBounds());
$('#map-pickups').on('click', '.btn-select-pickup', function (event) {
event.preventDefault();
$('#pickups-select').val($(this).data('id')).trigger('change');
// осталось только закрыть окно :(
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question