简体   繁体   English

cordova-plugin-googlemaps如何从标记数组触发标记的info_window

[英]cordova-plugin-googlemaps how to trigger the info_window of marker from marker array

I'm having hard time in showing info window of particular marker selected from marker array. 我很难显示从标记数组中选择的特定标记的信息窗口。

I'm using this plugin https://github.com/mapsplugin/cordova-plugin-googlemaps/wiki/Map with cordova. 我正在使用带有Cordova的插件https://github.com/mapsplugin/cordova-plugin-googlemaps/wiki/Map

I can move the Camera to particular marker location as I have latLng of the marker from the array but how to trigger the Info_window of the same Marker. 我可以将Camera移到特定的标记位置,因为我从数组中获得了latLng的标记,但是如何触发同一标记的Info_window。 Please Help 请帮忙

Finally found a solution for this. 终于找到了解决方案。 While adding marker on map. 在地图上添加标记时。 the function returns marker object, push the object an array. 该函数返回标记对象,将对象推入数组。 for an idea, 一个想法

for(var i= 0; i < data.length; i++){
   map.addMarker({
       'position': data[i].latLng,
       'title' : i
             }, function(marker){
              arrayOfMarkers.push(marker);
                 })

to invoke info_window 调用info_window

arrayOfMarker[i].show_infoWindow();

*don't go on the syntax, grab the idea *不要继续语法,抓住主意

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM