-1

http://ubilabs.github.io/geocomplete/examples/draggable.html为例。

HTML:

<div id="addresses">
        <label>Address 1</label>
        <input type="text" class="form-control geocomplete" id="addr_1" data-addrn="1" placeholder="Type your address here" value="" />
        <div class="map_canvas" id="addr_canvas_1"></div>
        <div id="addr_inf_1">
            <input type="hidden" data-geo-1="lat" placeholder="Latitude" value="" />
            <input type="hidden" data-geo-1="lng" placeholder="Longitude" value="" />
        </div>

<script src="https://maps.googleapis.com/maps/api/js?key=xxxxx&amp;libraries=places"></script>
<script src="jquery.geocomplete.min.js"></script>

JS:

$(function(){
$("#addresses").find(".geocomplete").each(function() {
    var $cElem = $(this);
    var $addrNum = $cElem.data("addrn");
    $cElem.geocomplete({
      map: "#addr_canvas_"+$addrNum,
      details: "#addr_inf_1"+$addrNum,
      detailsAttribute: "data-geo-"+$addrNum,
      markerOptions: {
        draggable: true
      }
    });
});});

问题是它显示地图而不是标记。为什么?

4

1 回答 1

0

这行 css 是阻塞地图上标记的原因

div {最大高度:999%;}

于 2016-08-24T09:16:18.587 回答