Javascript Google Place Autocomplete API下拉列表未在模式中显示

Javascript Google Place Autocomplete API下拉列表未在模式中显示,javascript,css,twitter-bootstrap,autocomplete,google-places-api,Javascript,Css,Twitter Bootstrap,Autocomplete,Google Places Api,我刚开始使用引导。我正在尝试将GoogleJSPlaceAutoCompleteAPI与Bootstrap3.0模式集成 模态CSS: #searchModal{ z-index:1041 !important; } .modal-header, h4, .close { background-color: #5cb85c; color: white !important; text-align: center; /*font-size: 30px;*/

我刚开始使用引导。我正在尝试将GoogleJSPlaceAutoCompleteAPI与Bootstrap3.0模式集成

模态CSS:

#searchModal{
    z-index:1041 !important;
}
.modal-header, h4, .close {
    background-color: #5cb85c;
    color: white !important;
    text-align: center;
    /*font-size: 30px;*/
}
.modal-footer {
    background-color: #f9f9f9;
} 
.modal-backdrop {
    opacity: 0.5 !important; 
}
自动完成JS:

function initMap() {
var oInput = document.getElementById('ocity-input');

var oSearchBox = new google.maps.places.SearchBox(oInput);

oSearchBox.addListener('places_changed', function() {
    var places = oSearchBox.getPlaces();

    places.forEach(function(place) {
        console.log(place.name);
        console.log(place.place_id);
    });
});
}`
自动完成CSS:

@CHARSET "ISO-8859-1";
html, body {
    height: 100%;margin: 0;padding: 0;
}
.form-control {
    margin-top: 10px;
    border: 1px solid transparent;
    border-radius: 2px 0 0 2px;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    height: 32px;
    outline: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
#ocity-input {
    background-color: #fff;
    font-family: Roboto;
    font-size: 15px;
    font-weight: 300;
    margin-left: 12px;
    padding: 0 11px 0 13px;
    text-overflow: ellipsis;
    width: 300px;
}
#ocity-input:focus {
    border-color: #4d90fe;
}
.ocity-container {
    font-family: Roboto;
    z-index: 10000;
    display: block !important;
}
模态代码:

<div class="container">
    <div class="modal fade" id="searchModal" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header" style="padding: 35px 50px;">
                    <h4 style="text-align: center;">
                        <span class="logo">Name</span>
                    </h4>
                </div>
                <div class="modal-body" style="padding: 40px 50px;">
                    <form role="form">
                        <div class="form-group">
                            <input id="ocity-input" class="form-control" type="text" placeholder="Origin">
                        </div>
                        <button type="submit" class="btn btn-success btn-block">
                            <span class="fa fa-undo"></span> Lets Go
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>
 </div>

名称
走吧

我在stackoverflow和internet上尝试了多个z-index帮助答案,但它们似乎对我不起作用。

该下拉列表与
#searchModal
(1041)的z-index相竞争

使用以下CSS定义,下拉列表应显示在顶部:

.pac-container {
    z-index: 1042;
}

给你。请将“您的API密钥”替换为您自己的密钥。

它确实修复了问题。我不知道,pac容器是必不可少的。我将pac容器修改为输入字段id