单击标记后,我需要移动 google 地图
I need to move a google map, after I click on the marker
当我点击标记时,会出现一个包含内容的信息窗口。问题是当标记靠近地图边缘时,信息窗口打开,其中一部分隐藏在地图之外。
我需要实现 "an animation" 移动地图,就像这里 https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple?hl=en
问题是我是新手,经验不多。问题是 - 在此示例中,哪个代码块负责地图移动? Latitude/longitude?
将不胜感激任何类型的答案。
更新
就我而言,最好的决定是通过 booking com 使 infoWindows 看起来像。
我的代码:
标记创建:
var marker = new google.maps.Marker ({
position: myLatlng
icon: image,
shadow: shadow,
shape: shape
});
信息窗口:
var theInfoBoxDiv = {
content: boxText,
closeBoxMargin: "10px",
disableAutoPan: true,
pixelOffset: new google.maps.Size(-150, 10)
};
每次 placemarker()
为 运行,它都会创建一个新标记。
您需要在 placemarker 函数外部创建一次标记,然后在 placemarker 内部使用 marker.setPosition()
。
当我点击标记时,会出现一个包含内容的信息窗口。问题是当标记靠近地图边缘时,信息窗口打开,其中一部分隐藏在地图之外。 我需要实现 "an animation" 移动地图,就像这里 https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple?hl=en
问题是我是新手,经验不多。问题是 - 在此示例中,哪个代码块负责地图移动? Latitude/longitude?
将不胜感激任何类型的答案。
更新 就我而言,最好的决定是通过 booking com 使 infoWindows 看起来像。
我的代码: 标记创建:
var marker = new google.maps.Marker ({
position: myLatlng
icon: image,
shadow: shadow,
shape: shape
});
信息窗口:
var theInfoBoxDiv = {
content: boxText,
closeBoxMargin: "10px",
disableAutoPan: true,
pixelOffset: new google.maps.Size(-150, 10)
};
每次 placemarker()
为 运行,它都会创建一个新标记。
您需要在 placemarker 函数外部创建一次标记,然后在 placemarker 内部使用 marker.setPosition()
。