gpt4 book ai didi

css - Bootstrap 3 - 修复后的导航栏问题

转载 作者:太空宇宙 更新时间:2023-11-04 04:11:15 25 4
gpt4 key购买 nike

使用 Bootstrap 3 导航栏,我想在输入文本字段上显示 Google 放置选项。以下是相同的屏幕截图:

enter image description here

从截图可以看出,固定navbar时,选项显示在后面。而且,当 navbar 是静态的时,选项会按预期显示。我希望在固定导航栏时正确显示选项。

我试图将代码指向 bootply,但它不起作用。工作代码在 JSFiddle .另外,代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Navbar Template for Bootstrap</title>

<!-- Bootstrap core CSS -->
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">

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

</head>

<body style="min-height: 2000px;">

<div class="container">

<!-- Static navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".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 class="navbar-brand" href="#">Project name</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Find <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" name="search" style="width: 20em;" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</li>
</ul>
</li>
</ul>

</div><!--/.nav-collapse -->
</div>



</div> <!-- /container -->


<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
</body>
</html>

<script>

window.onload = function() {

var options = {
types: ['geocode']
};

var inputField;
inputField = document.getElementsByName( 'search' )[0];
new google.maps.places.Autocomplete( inputField, options );

};

</script>

请帮忙。

提前致谢!

最佳答案

这是因为元素的 z-index。尝试更改 .pac-container 的 z-index。示例:.pac-container { z-index: 9999; }.

关于css - Bootstrap 3 - 修复后的导航栏问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20632962/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com