Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在谷歌地图上隐藏标记_Javascript_Google Maps_Google Maps Api 3_Google Maps Markers_Gmaps.js - Fatal编程技术网

Javascript 在谷歌地图上隐藏标记

Javascript 在谷歌地图上隐藏标记,javascript,google-maps,google-maps-api-3,google-maps-markers,gmaps.js,Javascript,Google Maps,Google Maps Api 3,Google Maps Markers,Gmaps.js,我在一个类似的网站上工作 我需要隐藏地图上的第一个标记 正在使用以下功能添加标记: function et_add_marker( marker_order, marker_lat, marker_lng, marker_description ) 并按编号顺序输出: et_add_marker( 0, 28.764060233517, -81.47733406250012, '<div id="et_marker_0" class="et_marker_info"><div

我在一个类似的网站上工作

我需要隐藏地图上的第一个标记

正在使用以下功能添加标记:

function et_add_marker( marker_order, marker_lat, marker_lng, marker_description )
并按编号顺序输出:

et_add_marker( 0, 28.764060233517, -81.47733406250012, '<div id="et_marker_0" class="et_marker_info"><div class="location-description"> <div class="location-title"> <h2>Beautiful Stairs</h2> <div class="listing-info"><p>Vacation Spot</p></div> </div> <div class="location-rating"><span class="et-rating"><span style="width: 68px;"></span></span></div> </div> <!-- .location-description --> </div> <!-- .et_marker_info -->' );
et_add_marker( 1, 37.80002992748194, -122.43711189453137, '<div id="et_marker_1" class="et_marker_info"><div class="location-description"> <div class="location-title"> <h2>San Francisco Bay</h2> <div class="listing-info"><p>Vacation Spot</p></div> </div> <div class="location-rating"><span class="et-rating"><span style="width: 85px;"></span></span></div> </div> <!-- .location-description --> </div> <!-- .et_marker_info -->' );

但到目前为止,他们只是成功地隐藏了所有的标记,或者仅仅是最后几个。我真的只需要隐藏第一个标记。我想我已经接近解决这个问题了。任何帮助都将不胜感激

您需要获得markers对象,然后在每个对象上调用setVisibile方法

var myMarkers = et_add_marker(...);
myMarkers[i].setVisible(false);
在下面的示例中,et_add_marker只返回一个marker对象,然后


您可以使用
setVisible(boolean)
setMap(null)
。 如果你想要任何文件,这里是链接

var myMarkers = et_add_marker(...);
myMarkers[i].setVisible(false);
var myMarkers = et_add_marker();
myMarkers.setVisible(false);