如何在谷歌地图 v3 中触发标记的 Dragend 事件?
我想在另一个事件(例如地图上的单击事件)中触发标记的拖尾事件。我怎样才能做到这一点?
google.maps.event.addListener(map,'click',function(pt){ posSelectMarker.setPosition(pt.latLng); //Here I want to fire dragend event. });
I want to fire dragend event of a marker in another event say click event on the map. how can I do that?
google.maps.event.addListener(map,'click',function(pt){ posSelectMarker.setPosition(pt.latLng); //Here I want to fire dragend event. });
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用
event.trigger
;Use
event.trigger
;这是更完整一点:
请注意,您可以使用事件参数获取对象
This is a bit more complete:
Note that you can get at the object with the event param
应该是:
而不是:
简单示例:
Should be:
instead of:
Quick example:
如果您有标记对象,则可以直接调用
addListener
来添加dragend
事件。If you have the marker object, you could call
addListener
directly to add adragend
event.