谷歌地图未显示在我的网页上 [英] google map not displaying on my webpage
本文介绍了谷歌地图未显示在我的网页上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是代码段.请有人帮我,因为我无法在我的网页上运行地图.我已经尝试了我所知道的一切,但这也没有用...
Here is code snippet. Please someone help me as i am unable to get the map running on my webpage. I have tried everything i know but that's also of no use...
地图未在我的网页上显示任何内容...
the map is not displaying anything on my webpage...
http://jsfiddle.net/gauravroy142/tZ7v2/
<head>
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var mapOptions = {
zoom: 12,
center: myLatlng
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<div id="contact-right">
<div class="panel-pane pane-block pane-amazeelabs-google-map" id="map">
<!--<div class="map">-->
<div id="map-canvas"></div> <!--</div>-->
</div>
<!--<div class="map">-->
<div id="address">
<p>Roy-Coy<br>
Varanasi-221007<br>
Uttar Pradesh<br>
India</p>
</div>
<div id="we-are-waiting-for-you">
<p id="tlf">+91 9805 463 715</p><br>
<p id="email"><a class="spamspan" href="mailto:gaurav.roy142@gmail.com">gaurav.roy142@gmail.com</a></p><br>
<p id="twitter"><a href="http://twitter.com/gauravroy11">@gauravroy11</a></p>
</div>
<p> </p>
<!--</div>-->
</div>
</body>
我也检查了api文档,但这也没有用...该地图未显示任何内容.
I have checked the api documentation also but that also of no use... The map is not displaying anything.
推荐答案
您的地图div#map-canvas(不是#map)没有大小.
Your map div, #map-canvas(not #map), doesn't have a size.
#map-canvas {
width:200px;
height:200px;
}
这篇关于谷歌地图未显示在我的网页上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文