模拟Google地图中的点击 [英] Simulate a click in a Google Map
问题描述
我在使用API v3模拟用户点击Google地图时,在地理位置定位了他们的位置后,我试图模拟用户点击Google Map。要做:
google.maps.event.trigger(地图,'点击',{
latLng:新谷歌.maps.LatLng(lat,lng)
});
但是现在我得到一个错误:
未捕获的TypeError:无法读取未定义的属性'wa'main.js:727
我需要模拟点击是因为我在CCK领域使用了Drupal,并且在点击引擎盖下进行这种操作,如果我将位置选择作为标记添加,则不会触发这些点击。 h2_lin>解决方案
地图对象的'click'事件需要 I'm trying to simulate a user click on a Google Map, using API v3, after I geolocate their position when they write down their address. I used to do: But now I got an error: Uncaught TypeError: Cannot read property 'wa' of undefined main.js:727 I need to simulate the click because I'm using Drupal with a CCK field, and it's doing this on clicks under the hood that are not triggered if I add the location pick as a marker. The map object's 'click' event takes a google.maps.MouseEvent object as parameter: 这篇关于模拟Google地图中的点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
stop:null,
latLng:new google.maps.LatLng(40.0,-90.0)
}
google.maps.event.trigger(map,'点击',mev);
google.maps.event.trigger(map, 'click', {
latLng: new google.maps.LatLng(lat, lng)
});
var mev = {
stop: null,
latLng: new google.maps.LatLng(40.0,-90.0)
}
google.maps.event.trigger(map, 'click', mev);