【发布时间】:2014-09-30 22:04:15
【问题描述】:
我下载了一个已经集成了 gmap 的模板。我所要做的就是调整标记,使其指向正确的位置。
我正在创建一个新网站,在联系页面上,我想添加与模板上相同的 gmap。
我使用相同的代码,复制相同的文件并将它们放在各自的目录中,但我无法让地图显示在我的页面上。
在 HTML 文档的 HEAD 中,我包含了以下代码:
<script src="https://maps.googleapis.com/maps/api/js"></script>
在 BODY 的更下方,我创建了一个像这样的 SECTION 标签:
<section id="map-section">
<div id="map"></div>
</section>
就在结束的 BODY 标记上方,我有这些 Javascript:
<script src="js/jquery-1.11.0.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="js/jquery.gmap.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#map').gMap(
{
latitude: 50.000000,
longitude: 50.000000,
html: "My Location",
popup: true,
panControl: true,
zoomControl: true,
zoomControlOptions:
{
style: google.maps.ZoomControlStyle.SMALL
},
mapTypeControl: true,
scaleControl: true,
streetViewControl: false,
overviewMapControl: true,
scrollwheel: true,
icon:
{
image: "http://www.google.com/mapfiles/marker.png",
shadow: "http://www.google.com/mapfiles/shadow50.png",
iconsize: [20, 34],
shadowsize: [37, 34],
iconanchor: [9, 34],
shadowanchor: [19, 34]
},
zoom:15,
markers: [{
latitude: 50.000000,
longitude: 50.000000
}]
});
});
</script>
另外,在我的 CSS 中,我的 MAP-SECTION 看起来像这样:
#map-section {
bottom: 0px;
padding: 0px;
height: 250px;
width: 100%;
z-index: 0;
border: 1px solid red;
}
#map{
display: block;
height: 250px;
width: 100%;
min-width: 100%;
max-width:1350px;
margin-left:auto;
margin-right:auto;
}
如果您在 CSS 中注意到,在 #map-section 中,我在屏幕上添加了一个红色边框。它只是没有显示地图。
谁能看到我错过了什么?
请帮忙。
【问题讨论】:
-
在浏览器中调试会出现javascript错误吗?
标签: javascript jquery html map jquery-gmap3