Google Maps API v3 infowindow关闭事件/回调? [英] Google Maps API v3 infowindow close event/callback?
本文介绍了Google Maps API v3 infowindow关闭事件/回调?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我喜欢跟踪在Google地图界面上打开的任何和所有infowindows(我将它们的名称存储在数组中),但我无法弄清楚如何通过数组将它们从数组中移除每个人的右上角的x。
I like to keep track of any and all infowindows that are open on my Google Maps interface (I store their names in an array), but I can't figure out how to remove them from my array when they are closed via the "x" in the upper right hand corner of each one.
有什么回调我可以听?或者,也许我可以做一些像
addListener(close,infowindow1,等等
?
Is there some sort of callback I can listen for? Or maybe I can do something like
addListener("close", infowindow1, etc
?
推荐答案
infowindows调用 closeclick
可以帮助您的事件
there's an event for infowindows call closeclick
that can help you
var currentMark;
var infoWindow = new google.maps.InfoWindow({
content: 'im an info windows'
});
google.maps.event.addListener(marker, 'click', function () {
infoWindow.open(map, this);
currentMark = this;
});
google.maps.event.addListener(infoWindow,'closeclick',function(){
currentMark.setMap(null); //removes the marker
// then, remove the infowindows name from the array
});
这篇关于Google Maps API v3 infowindow关闭事件/回调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文