Employing a variation on function attachSecretMessage
并使用mousedown
事件,我可以将标记的title
属性包含为Closure,但是在桌面平台上,当用户点击标记然后将鼠标移出打开的infowindow
,拖动地图直到用户点击其他地方(我还不知道移动平台上发生了什么)。我试图删除地图的draggable
功能,但未成功。地图的可拖动能否被打败?
function attachClickMessage(marker, message) {
var infowindow = new google.maps.InfoWindow(
{ content: message, size: new google.maps.Size(50,50) });
google.maps.event.addListener(marker, 'mousedown', function() {
map.draggable = false;
infowindow.open(map,marker);
});
}
答案 0 :(得分:0)
糟糕。看起来简单地重新排序javascript指令就会失败。我在map.draggable = false;
后移动info window.open()
,不再拖动。
function attachClickMessage(marker, message) {
var infowindow = new google.maps.InfoWindow(
{ content: message, size: new google.maps.Size(50,50) });
google.maps.event.addListener(marker, 'mousedown', function() {
infowindow.open(map,marker);
map.draggable = false;
});
}