我在 sencha touch 2 上有一张地图,上面装有标记(动态)。目前,当我单击标记时,它们各自的信息窗口会打开。我想使用信息窗口中的按钮或单击标记来打开容器。
这可能吗,有人可以指导我吗?我只知道它与标记的听众有关......
我在 sencha touch 2 上有一张地图,上面装有标记(动态)。目前,当我单击标记时,它们各自的信息窗口会打开。我想使用信息窗口中的按钮或单击标记来打开容器。
这可能吗,有人可以指导我吗?我只知道它与标记的听众有关......
In order to listen the click event for a marker you can use the following code:
google.maps.event.addListener(marker, 'click', onClickHandler);
marker is a google.maps.Marker.
If you want to put a button inside of infoWindow. You could listen for click events in the infoWindow and then check if the click was inside a button.
....
infoWindow.content = '<div>text</div><div class="button">button</div>';
infoWindow.content.addEventListener('click', onInfoWindowClickHandler);
function onInfoWindowClickHanlder(event) {
if(event.target.className == 'button') {
// Button click
}
}
This is only one aproximation. I've not tested the code, so could need some tunning, but the idea should work.
You must read https://developers.google.com/maps/documentation/javascript/