Google Maps API v3 infowindow关闭事件/回调?(Google Maps API v3 infowindow close event/callback?)
我喜欢跟踪在我的Google Maps界面上打开的任何和所有infowindows(我在数组中存储他们的名字),但是当我们通过“x”关闭时,我不知道如何将它们从数组中删除“在每一个的右上角。
有什么回调我可以听吗? 或者我可以做一些类似addListener("close", infowindow1, etc ?
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.
Is there some sort of callback I can listen for? Or maybe I can do something like addListener("close", infowindow1, etc ?
最满意答案
有一个可以帮助你的closeclick调用closeclick的事件
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 });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 });更多推荐
发布评论