Jquery位置选择器自动完成功能在bootstrap模式中不起作用

时间:2017-01-03 13:55:45

标签: javascript jquery html bootstrap-modal jquery-location-picker

我在bootstrap模式中使用jquery位置选择器。它会打开地图,但自动填充建议不可见。

下面给出了html和javascript代码。



$timeout(function() {
   $('#onboardingModal').on('shown.bs.modal', function() {
   $('#mappicker').locationpicker({
      location: {
         latitude: 12.9715987,
         longitude: 77.59456269999998
      },
      radius: 200,
      inputBinding: {
         locationNameInput: $('#locationInput')
      },
      enableAutocomplete: true,
      autocompleteOptions: {
          componentRestrictions: {country: 'in'}
      },
      onchanged: function (currentLocation, radius, isMarkerDropped) {
                          var addressComponents = $(this).locationpicker('map').location.addressComponents;
                          $scope.lat = $(this).locationpicker('map').location.latitude
                          $scope.lng = $(this).locationpicker('map').location.longitude
                          // updateControls(addressComponents);
       },
    });
  });
});

<div class="modal fade" id="onboardingModal" tabindex="-1" role="dialog" aria-labelledby="onboardingModalLabel" style="overflow:hidden" data-backdrop="static" data-keyboard="false">
   <div class="modal-dialog" role="document">
       <div class="modal-content">
          <div class="form-group">  
             <label for="locationInput">LOCATION</label>
             <input type="text" class="form-control" id="locationInput" placeholder="Search"/> 
             <div align="center" class="map" id="mappicker" style="width: 500px !important; height: 300px"></div>
          </div>
      </div>
   </div>
</div>
&#13;
&#13;
&#13;

尝试更改z-index还添加了uqu-front类的jquery,并没有处理任何一种情况。 我在这做错了什么?

1 个答案:

答案 0 :(得分:3)

我在github的一个问题中得到了答案。需要将z-index添加到pac-container。

.pac-container{z-index:2000 !important;}

参考:Github issue