Jquery Can';不要在谷歌地图上隐藏带有标签的标记

Jquery Can';不要在谷歌地图上隐藏带有标签的标记,jquery,google-maps,Jquery,Google Maps,我正在使用此代码显示集合并显示多个标记: MarkerStore[res[i].id].setIcon(icon); 然后,我将标记放置在以下位置: var marker = new google.maps.Marker({ position: new google.maps.LatLng(res[i].position.lat,res[i].position.long), title:'',

我正在使用此代码显示集合并显示多个标记:

MarkerStore[res[i].id].setIcon(icon);
然后,我将标记放置在以下位置:

var marker = new google.maps.Marker({
                        position: new google.maps.LatLng(res[i].position.lat,res[i].position.long),
                        title:'',
                        map:map,
                        icon: icon, 
});
并将其隐藏(如果需要):

这很好用。因此,现在我想使用
MarkerWithLabel
选项添加标签。我把密码改成

var marker = new MarkerWithLabel({
                        position: new google.maps.LatLng(res[i].position.lat,res[i].position.long),
                        labelContent: markerLabel,
                        labelAnchor: new google.maps.Point(18, 12),
                        labelClass: "my-custom-class-for-label",
                        labelInBackground: true,
                        title:'',
                        map:map,
                        icon: icon,
});

突然,它不再工作了。它不会隐藏任何东西,但会显示地图上的所有标记,即使它们应该隐藏。我做错了什么?这是不是
MarkerWithLabel
功能有问题?

我很清楚:您的
MarkerWithLabel
正确创建了标记,唯一的问题是您的
…setVisible()
代码没有正确隐藏它们?是的,这是正确的。请提供一个示例来说明问题。
var marker = new MarkerWithLabel({
                        position: new google.maps.LatLng(res[i].position.lat,res[i].position.long),
                        labelContent: markerLabel,
                        labelAnchor: new google.maps.Point(18, 12),
                        labelClass: "my-custom-class-for-label",
                        labelInBackground: true,
                        title:'',
                        map:map,
                        icon: icon,
});