单击时将类添加到标记 [英] Add class to marker on click
本文介绍了单击时将类添加到标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Google地图上,我想在点击标记时向标记添加一个类。
我搜索了API,但找不到解决方案。
你有任何线索吗?
On Google Maps I would like to add a class to the marker when clicking on it. I've searched the API but I can't find a solution. Do you have any leads?
推荐答案
google.maps.event.addListener(marker, 'click', function() {
marker.set("class", "className");
});
您也可以在创建标记时做到这一点
marker = new google.maps.Marker({
position: new google.maps.LatLng(lat, lng),
map: map,
class:'className'
draggable: true
});
这篇关于单击时将类添加到标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文