为什么“事件未定义”当右键单击 google-map-v3 时
这是我的代码:
google.maps.event.addListener(marker, 'rightclick', function(event) {
//delete marker
var nowIndex1='nowIndex1';
function callback1(element, index){
if(marker == element) nowIndex1=index
}
markers.forEach(callback1)
if(nowIndex1!='nowIndex1') markers.removeAt(nowIndex1)
//delete path
var nowIndex2='nowIndex2';
function callback2(element, index){
if(event.latLng == element) nowIndex2=index
}
path.forEach(callback2)
if(nowIndex1!='nowIndex1') path.removeAt(nowIndex2)
marker.setMap(null)
})
错误是“事件未定义”,
所以我应该做什么。
谢谢
this is my code:
google.maps.event.addListener(marker, 'rightclick', function(event) {
//delete marker
var nowIndex1='nowIndex1';
function callback1(element, index){
if(marker == element) nowIndex1=index
}
markers.forEach(callback1)
if(nowIndex1!='nowIndex1') markers.removeAt(nowIndex1)
//delete path
var nowIndex2='nowIndex2';
function callback2(element, index){
if(event.latLng == element) nowIndex2=index
}
path.forEach(callback2)
if(nowIndex1!='nowIndex1') path.removeAt(nowIndex2)
marker.setMap(null)
})
and the error is "event is undefined"
so what should i do .
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个不好。它应该返回 DOM 的 mousedown 事件。我相信这是一个错误。我还尝试访问该事件,因为我想在指针旁边放置一个菜单,所以我必须使用框架为我提供指针的位置,以完成将菜单放在标记旁边。
This one is bad. It is supposed to return the DOM's mousedown event. I believe it is a bug. I also tried to access the event, because I wanted to place a menu next to the pointer, so I had to use the framework to give me the location of the pointer to accomplish putting the menu next to the marker.