admin管理员组文章数量:1416305
This question is related to my question here:
Google Maps V3 -> Is it possible to get properties from Geojson using lat lng coordinates or other information from search box?
Since it is possible to trigger a click event programmatically like this, I'm wondering if I can trigger a click event on a given lat/lng position in the same way?
Example code:
google.maps.event.trigger(marker, 'click');
Pseudo code of what I would like to do:
google.maps.event.trigger(place.geometry.location, 'click');
How to trigger the onclick event of a marker on a Google Maps V3?
Given the documentation it is really a long shot, but it would solve my current problem.
.exp/reference#event
This question is related to my question here:
Google Maps V3 -> Is it possible to get properties from Geojson using lat lng coordinates or other information from search box?
Since it is possible to trigger a click event programmatically like this, I'm wondering if I can trigger a click event on a given lat/lng position in the same way?
Example code:
google.maps.event.trigger(marker, 'click');
Pseudo code of what I would like to do:
google.maps.event.trigger(place.geometry.location, 'click');
How to trigger the onclick event of a marker on a Google Maps V3?
Given the documentation it is really a long shot, but it would solve my current problem.
https://developers.google./maps/documentation/javascript/3.exp/reference#event
Share Improve this question edited Dec 27, 2017 at 10:07 beaver 17.7k2 gold badges43 silver badges68 bronze badges asked Dec 26, 2017 at 2:17 OgglasOgglas 70.6k42 gold badges380 silver badges474 bronze badges1 Answer
Reset to default 7You can try passing additional arguments to trigger
method:
var e = {
latLng: new google.maps.LatLng(-35, 151)
};
google.maps.event.trigger(map, 'click', e);
Here is a working example showing infoWindow every time map is clicked (or on programmatic trigger): https://jsfiddle/beaver71/5ndjq8ge/
本文标签:
版权声明:本文标题:javascript - Google Maps V3 -> Is it possible to trigger the on click event on a specific coordinate (lat, lng) programma 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745253546a2649965.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论