防止谷歌地图infowindow关闭 [英] Prevent Google maps infowindow from closing
本文介绍了防止谷歌地图infowindow关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果在infoWindow关闭时满足某些条件,我想阻止触发的默认关闭事件。这有可能实现吗?我尝试了很多类似的东西:
If certain conditions are met when an infoWindow is closed, I want to prevent the default close event that is fired. Is it possible to achieve that? I tried a number of things like:
- 停止事件传播
- 从回调方法返回false
- 没有任何infoWindow公开的方法/属性可以阻止关闭。
- Stopping event propagation
- returning false from the callback method
- there aren't any methods/properties exposed by the infoWindow either that prevent close.
请让我知道如果这是可能的。
Please let me know if this is possible.
推荐答案
您可以随时监听关闭事件,然后将JavaScript错误防止它关闭。例如:
You could always listen for the close event and then throw a javascript error to keep it from closing. Ex:
google.maps.event.addListener(my_infoWindow, 'closeclick', function(e){
// Throw an error to stop the close
throw "stop close";
})
这篇关于防止谷歌地图infowindow关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文