5

使用引导程序 3,我在导航栏下拉链接中放置了一个搜索表单,我正在尝试使用 JQuery Geocomplete 插件(http://ubilabs.github.io/geocomplete/)来填充地址表单输入。但是,地址建议出现在表单后面……有没有办法用 CSS 解决这个问题?

截屏

在标题中:

<script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places"></script>

HTML 代码:

<header class="navbar navbar-green navbar-fixed-top navbar-green" role="banner">
    <div class="container">
        <div class="navbar-header">
            <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse"> <span class="sr-only">Toggle navigation</span>
 <span class="icon-bar"></span>

                <span
                class="icon-bar"></span> <span class="icon-bar"></span>

            </button>   <a href="index.php" class="navbar-brand">Brand</a>

        </div>
        <nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
            <ul class="nav navbar-nav">
                <li><a href="#"><i class="icon-map-marker"></i> Browse</a>
                </li>
            </ul>
            <ul class="nav navbar-nav">
                <li class="dropdown active"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-search"></i> Find <b class="caret"></b></a>

                    <ul
                    class="dropdown-menu search">
                        <form class="navbar-form navbar-left" role="search">
                            <div class="form-group">
                                <button type="button" class="btn btn-default navbar-btn" data-toggle="tooltip"
                                data-placement="right" title="Use your exact location">
                                    <li class="icon-screenshot"></li>
                                </button>
                            </div>
                            <div class="form-group">
                                <input type="text" class="form-control" placeholder="Address" name="address"
                                id="address">
                            </div>
                            <div class="form-group">
                                <select class="form-control">
                                    <option>1</option>
                                    <option>2</option>
                                    <option>3</option>
                                    <option>4</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-green">Search</button>
                            </div>
                        </form>
            </ul>
            </li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">   <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user"></i> USER<b class="caret"></b></a>

                    <ul
                    class="dropdown-menu">
                        <li><a href="#"><i class="icon-pencil"></i> Profile</a>
                        </li>
                        <li><a href="#"><i class="icon-upload"></i> Submit</a>
                        </li>
                        <li class="divider"></li>
                        <li><a href="#"><i class="icon-signout"></i> Log out</a>
                        </li>
            </ul>
            </li>
            </ul>
        </nav>
    </div>
</header>

在文件的末尾,我有:

<script src="assets/js/jquery.geocomplete.js"></script>

<script>
    $(function () {
        $("#address").geocomplete({
            componentRestrictions: {
                country: 'GB'
            }
        })
    });
</script>
4

1 回答 1

11

谷歌自动完成将结果包装在一个容器中,pac-container该容器的 z-index 为 1000(由内联 css 设置)。默认情况下,下拉菜单具有相同的 z-index。为了解决这个问题,为 .pac-container 添加一个更高的 z-index:

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

参考:

于 2013-09-01T14:02:37.053 回答