Answer the question
In order to leave comments, you need to log in
How to change the icon on Yandex.maps by clicking on it?
There is a site with marks on the map,
I want to add the function of selecting a mark on the map by clicking on it.
I found such a function for changing parameters in the Yandex.map sandbox, but it does not work,
maybe you need to somehow redraw the labels?
myPlacemark549.properties
.set({
iconImageHref: '/bitrix/templates/mosnt/img/Иконка_Активная.png'
});
myPlacemark549 = new ymaps.Placemark([56.1440526,37.9992412],
{
}, {
iconImageHref: '/bitrix/templates/mosnt/img/Иконка_Лукойл.png',
iconImageSize: [64, 64],
iconImageOffset: [-32, -64],
balloonContentSize: [270, 190]
});
myPlacemark549.base = 549;
myMap.geoObjects.add(myPlacemark549);
myPlacemark549.events.add('click', function () {
elem = $("#route-from").parents(".forselect").find("li[data-baza='#nb549']");
$('.styledSelect').html($(elem).html()).removeClass('active');
$('.custom-select').val($(elem).attr('rel'));
$('.toplivo-table').css('display','none');
$($(elem).data('baza')).css('display','block');
$('#baza').html($(elem).html());
myPlacemark549.properties
.set({
iconImageHref: '/bitrix/templates/mosnt/img/Иконка_Активная.png'
});
});
placemarks_list.push(myPlacemark549);
Answer the question
In order to leave comments, you need to log in
try accessing the element via this rather than the name of the object within itself
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question