【发布时间】:2014-06-10 07:55:15
【问题描述】:
我正在使用 Google Maps API v3 和 MarkerClustererPlus 库。我宁愿不使用光栅图标,而是使用 MarkerClusterer 对象的 styles 和 ClusterClass 属性渲染气泡。这是我在 JS 代码中的 style 对象:
var myClusterStyle = [{
url: './icons/placeholder.png', //1x1 transparent png
height: 40,
width: 40,
textColor: '#636363',
textSize: 12
}];
还有 CSS 类:
.cluster {
background-color: #EAE6DE;
border-radius: 50%;
border: 3px solid #ACCCFD;
position: absolute;
}
所以,这些是带有蓝色边框的灰色气泡。
我的问题是:
我想在鼠标悬停时更改单个气泡的一些属性,比如更改颜色或添加阴影。我可以更改气泡的 CSS 类吗?我花了很多时间试图弄清楚这一点,现在我被困住了。我有这个活动:
google.maps.event.addListener(mc,'mouseover',function(c){
c.clusterIcon_.setValues({className_:'clusterHover'});
});
它确实改变了气泡的 CSS 类选项,但显示没有改变...跟随 mc.repaint(), c.clusterIcon_.draw() 无济于事。
我看过这个帖子: Marker Clusterer Plus change icon on hover 但这是用于更改图标,而不是样式属性。在不修改库的情况下这真的可能吗?任何帮助将不胜感激。
【问题讨论】:
标签: google-maps-api-3 markerclusterer