Google Maps API v3 infowindow关闭事件/回调?(Google Maps API v3 infowindow close event/callback?)

系统教程 行业动态 更新时间:2024-06-14 16:59:17
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 });

更多推荐

本文发布于:2023-04-16 14:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/ac9a6e73ca445653470e3713340a678e.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:回调   事件   Google   Maps   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!