Google maps search box outside map

前端 未结 2 1423
面向向阳花
面向向阳花 2021-01-31 22:09

I\'m playing with the Google Maps API, and I\'ve inserted a search-form with autocomplete. The problem is that the input-box is stuck into the map. I can\'t display it outside t

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-31 22:28

    Basically if I understand it well, you want to have an input with autocomplete that update the Google maps. But you want it outside the map

    This line, is what bind your input to the map. You don't need it

    map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
    

    Then you just remove the left: 1000px from your input and that's it.

    http://jsfiddle.net/KyMCy/5/

提交回复
热议问题