0
我試圖在我的網站上實現Google Maps API,但不幸取得了一點成功。由於Bootsrap和谷歌地圖之間的衝突而導致的Grey div
我使用的引導與大多數CSS設置保持不變。
經過研究和探索,我發現,如果我從我的代碼刪除引導的3 CDN代碼行的一整天:在bootsrap代碼運行時
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
谷歌地圖加載完美,但,那麼我看到的只是一個帶有Google簽名的灰色div。
另外。我發現,如果我調整瀏覽器的大小,那麼地圖加載完美 - 如預期的那樣。
Las事情,地圖位於標籤內,五分之一,我沒有更改標籤的初始CSS設置。
請幫幫忙,下面
代碼:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0">
<title>sys</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href='http://fonts.googleapis.com/earlyaccess/notosans.css' rel='stylesheet' type='text/css'>
<link href="includes/styles.css" rel="stylesheet" type="text/css">
<link rel="icon" type="image/png" href="includes/icons/favicon.png" />
<script src="http://canvasjs.com/assets/script/canvasjs.min.js"></script>
<script src="js/ajax.js"></script>
<script src="js/hideCaseDetailsifVolunteer.js"></script>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('googleMap'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
function loadScript()
{
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.googleapis.com/maps/api/js?key=AIzaSyAfUA7aWeXe4fxoBE9PzjWRJ3MRlcSaYh0&callback=initMap";
document.body.appendChild(script);
}
window.onload = loadScript;
</script>
....
.....
....
....
<div id="menu4" class="tab-pane fade">
<div id="map-container">
<div id="googleMap" style="width:100%;height:400px;"></div>
</div>
</div>
CSS:
@media (max-width: 970px) {
.navbar-header {
float: none;
}
.navbar-left, .navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none !important;
}
.navbar-nav {
float: none !important;
margin-top: 7.5px;
}
.navbar-nav > li {
float: none;
}
.navbar-nav > li > a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in {
display: block !important;
}
}
nav, header, section, footer, article {
display: block;
}
.container {
}
.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus {
background-color: #4CAF50;
}
.navbar-custom .navbar-toggle, .navbar-custom .nav .open > a, .navbar-custom .nav .open > a:hover, .navbar-custom .nav .open > a:focus {
background-color: #FFC107;
}
.navbar-custom {
background-color: #263238;
color: #FFFFFF;
border-radius: 0;
}
.navbar-custom .navbar-nav > li > a {
color: #fff;
}
.navbar-custom .navbar-nav > .active > a, .navbar-nav > .active > a:hover, .navbar-nav > .active > a:focus {
color: #ffffff;
background-color: transparent;
}
.navbar-custom .navbar-nav > li > a:hover, .nav > li > a:focus {
text-decoration: none;
background-color: #FFC107;
}
.navbar-custom .navbar-brand {
color: #F44336;
}
.navbar-custom .navbar-toggle {
background-color: #607D8B;
}
.navbar-custom .icon-bar {
background-color: #FFFFFF;
}
.dropdown-menu > li > a {
color: #515151;
}
.color_position {
color: #0a8b9b;
font-size: 80%;
}
.logo {
position: relative;
bottom: 10px;
height: 38px;
width: 163px;
}
.navbar-collapse {
border-top: 0px !important;
box-shadow: none;
}
.right-to-left {
margin-top: 30px;
}
.right-to-left li {
float: right;
}
.tab-content {
direction: rtl;
}
/* Code below Turns Off Number Input Spinners*/
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
.panel-group {
margin: 0 auto;
width: 80% /* value of your choice which suits your alignment */
}
#tip {
background-image: url(images/tip1.png);
height: 64px;
width: 260px;
}
#birthday {
background-image: url(images/birthdays1.png);
height: 64px;
width: 260px;
}
#whatsnew {
background-image: url(images/whatsnew.png);
height: 64px;
width: 260px;
}
#importantphones {
background-image: url(images/importantphones.png);
height: 64px;
width: 260px;
}
.turn {
float: right;
}
.lil {
float: right;
}
#chartContainer {
width:500px;
direction: ltr;
}
.buttonn{
margin:10px;
}
/*יצירת פנייה*/
textarea{
resize:none;
}
.heading
{
text-align:center;
margin:5px;
font-size:15px;
color:blue;
}
#select_box
{
width:350px;
background-color:#819FF7;
padding:10px;
height:375px;
border-radius:5px;
box-shadow:0px 0px 10px 0px grey;
}
select
{
width:329px;
height:35px;
border:1px solid #BDBDBD;
margin-top:20px;
padding:2px;
font-size:15px;
color:grey;
border-radius:5px;
}
.clear {
clear: both;
}
謝謝,你解決了我的問題! – Json
很酷。那麼請接受答案!謝謝。 – MrUpsidown