隐藏并显示事件标记

问题描述

|
google.maps.Marker.prototype.hide = function() 
{
    if (this.div_) 
    {
        this.div_.style.visibility = \"hidden\";
    }
};
google.maps.Marker.prototype.show = function() 
{
    if (this.div_) {
        this.div_.style.visibility = \"visible\";
    }
};
它不会导致任何错误。但是当我使用它时它不起作用:
marker = new google.maps.Marker({
                map: map,draggable: false,position: latlng,title: \'some title\'
            });
现在,如果有人更改缩放比例,我想触发隐藏标记
google.maps.event.addListener(map,\'zoom_changed\',function() {
            marker.hide();
});
但它不起作用。有人可以帮我解决问题吗?     

解决方法

隐藏标记使用use3ѭ 要再次显示,请使用
marker.setMap(mymap);
编辑: 忘记了setvisible。这是一个工作示例: http://jsfiddle.net/herostwist/v9nmQ/1/     ,API已经包含这样的方法:“ 5”。通过
true
false
。