I use Yandex.Maps API 1.1 .
He made a conclusion of several regions as a whole and their painting in one color. Such a question - is it possible to make a tooltip like in this example , but only with your own text (such as "Название_области ололо"
?
So far I have made a conclusion of the text I want on the aggregate of regions with the help of new Placemark
( link to fiddle ) , but I would like this text to be displayed immediately when you hover over the aggregate of regions without any Placemark
.
Is it possible?
<script src="https://api-maps.yandex.ru/1.1/index.xml?modules=regions" type="text/javascript"></script><script type="text/javascript"> <!-- ДЛЯ ВЫВОДА ИНДЕКСА МАССИВА (ДЛЯ ПОДДЕРЖКИ В IE) --> (function(A) { A.indexOf = A.indexOf || function(object) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === object) { return i; } } return -1; }; })(Array.prototype); <!-- СОЗДАНИЕ КАРТЫ --> YMaps.jQuery(function () { var map = new YMaps.Map(YMaps.jQuery("#YMapsID")[0]); map.setCenter(new YMaps.GeoPoint(55, 55), 4); var zoom = new YMaps.Zoom();map.addControl(zoom);map.enableScrollZoom(true); YMaps.Regions.load("ru", function (state, response) { if (state == YMaps.State.SUCCESS) { <!-- 1-Я СОВОКУПНОСТЬ РЕГИОНОВ --> var shapes, polygon; var regionVba1 = response.filter(function (obj) { var names = [ "Кировская область", "Нижегородская область", "Пензенская область", "Республика Марий Эл", "Республика Мордовия", "Самарская область", "Саратовская область", "Ульяновская область", "Чувашская Республика" ]; return (names.indexOf(obj.name) > -1); }); for (var i = 0; i < regionVba1.length; i++) { shapes = regionVba1[i].metaDataProperty.encodedShapes; for (var ix = shapes.length; ix--; ) { polygon = YMaps.Polygon.fromEncodedPoints( shapes[ix].coords, shapes[ix].levels ); polygon.setStyle({ polygonStyle: { fillColor: "b00c0c50", strokeColor: "b00c0c" } }); map.addOverlay(polygon); } } <!-- Выводим нужный нам текст --> var placemark1 = new YMaps.Placemark(new YMaps.GeoPoint(45, 54), {hasHint: true}); placemark1.name = "Поволжская зона"; map.addOverlay(placemark1); } else { alert ("Error: " + response.Error.Message) } }); }) </script>
As far as I understand, it is necessary to put such a hint , but I do not understand how to tie it to the totality of the regionVba1
regions ..