我在Google Maps V3上有足够简单的地图。如何判断当前是否选择了Google地图标记?
我将鼠标上的图标图像更改为侦听器事件,我将其更改回鼠标上,使其足够简单。
当我点击标记时,我再次更改图标,但是,我想在选择标记时保留该图标。当我将鼠标移出时,标记图标会再次发生变化,因为我告诉它在鼠标移出侦听器事件中这样做。
我需要从mouseout侦听器事件中排除选定的标记,但我无法弄清楚如何找到我当前选择的标记。有任何想法吗?
这里是我的代码
google.maps.event.addListener(marker, 'mouseover', function() {
this.setIcon("images/star-3-white.png");
});
google.maps.event.addListener(marker, 'mouseout', function() {
// this overwrites the image again,
// need to exclude the current one here
this.setIcon("images/star-3.png");
});
google.maps.event.addListener(marker, 'click', function() {
this.setIcon("images/star-3-white.png");
infowindow.setContent(this.html);
infowindow.open(map, this);
});