简体   繁体   English

当用户在 Google map 之外点击时如何触发事件

[英]How to fire event when user clicks outside Google map

When you are editing a text field, and you click outside that text field, a "blur" event fires on that text field element that you can do fun stuff with.当您编辑文本字段并在该文本字段外部单击时,会在该文本字段元素上触发一个“模糊”事件,您可以用它来做一些有趣的事情。

I'm building a Google map where you're editing a line, and I want to do some fun stuff when a user clicks outside the map.我正在构建一个谷歌 map,你正在编辑一行,当用户在 map 之外点击时,我想做一些有趣的事情。 (ie deselect the current path, and start a new path when the map is clicked again) (即取消选择当前路径,再次点击map时开始新路径)

Catching a click event on the page in general feels clumsy.在页面上捕捉点击事件通常感觉很笨拙。 Is there a google maps equivalent of the "blur" or "focusout" event?是否有相当于“模糊”或“聚焦”事件的谷歌地图?

You could try adding a dom listener to the map overlay for the blur event.您可以尝试将 dom 侦听器添加到模糊事件的 map 叠加层。

http://code.google.com/apis/maps/documentation/javascript/events.html#DomEvents http://code.google.com/apis/maps/documentation/javascript/events.html#DomEvents

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

相关问题 当用户在引导模式对话框之外单击时如何捕获事件? - How to catch event when user clicks outside of bootstrap modal dialog? Angular 5-当用户在目标元素之外单击时如何触发事件 - Angular 5 - How to trigger event when user clicks outside targeted elements 用户何时在div之外单击时的jQuery事件? - JQuery Event for when user clicks outside a div? 当用户在下拉菜单之外单击时如何隐藏下拉菜单 - How to hide a dropdown when the user clicks outside of it 用户通过ImageMapster单击地图区域时,如何更改PHP页面中显示的Google文档? - How to change Google Doc displayed in PHP page when user clicks map area through ImageMapster? 用户单击Google图表上的x轴时捕获事件 - Capture event when user clicks on x axis on Google charts 触发任何Google Map事件后如何触发动作 - How to fire action when ANY Google Map Event Has Been Fired 当用户点击div之外时,如何在Backbone中隐藏div? - How to hide a div in Backbone when user clicks outside of div? 用户在菜单外单击时如何关闭Bootstrap导航栏下拉菜单? - How to close the Bootstrap navbar dropdown when the user clicks outside the menu? 当用户在其外部单击时隐藏元素 - Hide an element when a user clicks outside of it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM