我正在使用 Google Maps API,并且插入了一个具有自动完成功能的搜索表单。问题是输入框卡在了 map 中。我无法在 map 外显示它。
<div style=" margin-top:100px;background: #00a6d6; width: 100%; height:100px;"><input id="address" style="position:absolute; left:1000px;" type="text"
placeholder="Enter a location"></div>
<div>
<div id="map-canvas" style="height:500px; width:500px;"></div></div>
http://jsfiddle.net/KyMCy/1/看这里。我希望搜索框位于蓝色容器中。
谢谢。
最佳答案
基本上,如果我理解得很好,您希望有一个带有自动完成功能的输入来更新 Google map 。但是你想要它在 map 之外
这一行将您的输入绑定(bind)到 map 。你不需要它
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
然后您只需从输入中删除 left: 1000px
即可。
关于jquery - map 外的谷歌地图搜索框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20921378/