Создаю общий макет балуна для кластера и метки,но не работает,к кластеру применяется к метке нет
MyBalloonLayout = ymaps.templateLayoutFactory.createClass(
'<div class="popover-bg">' +
'<a class="close" href="#">×</a>' +
'<div class="arrow"></div>' +
'<div class="popover-inner">' +
'$[[options.contentLayout observeSize minWidth=315 maxWidth=auto ]]' +
'</div>' +
'</div>', {
build: function () {
this.constructor.superclass.build.call(this);
this._$element = $('.popover', this.getParentElement());
this.applyElementOffset();
this._$element.find('.close')
.on('click', $.proxy(this.onCloseClick, this));
},
clear: function () {
this._$element.find('.close')
.off('click');
this.constructor.superclass.clear.call(this);
},
applyElementOffset: function () {
this._$element.css({
left: -(this._$element[0].offsetWidth / 2),
top: -(this._$element[0].offsetHeight + this._$element.find('.arrow')[0].offsetHeight)
});
},
onCloseClick: function (e) {
e.preventDefault();
this.events.fire('userclose');
},
_isElement: function (element) {
return element && element[0] && element.find('.arrow')[0];
}
}),
var clusterer = new ymaps.Clusterer({
clusterDisableClickZoom: false,
clusterOpenBalloonOnClick: true,
clusterBalloonPanelMaxMapArea: 0,
clusterBalloonMaxHeight: 200,
clusterBalloonItemContentLayout: customItemContentLayout,
clusterBalloonWidth: 315,
hideIconOnBalloonOpen: false,
clusterBalloonLayout: MyBalloonLayout
});
points = [
[55.831903,37.411961], [55.763338,37.565466], [55.763338,37.565466], [55.744522,37.616378], [55.780898,37.642889] ]
var placemark = new ymaps.Placemark(points, {
balloonLayout: MyBalloonLayout,
balloonContentBody: "тело метки",
});
placemarks.push(placemark);
clusterer.add(placemarks);
whereMap.geoObjects.add(clusterer);
});