简体   繁体   中英

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. (ie deselect the current path, and start a new path when the map is clicked again)

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM