这是代码片段。请有人帮助我,因为我无法在我的网页上运行地图。我已经尝试了我所知道的一切,但这也没用......
地图在我的网页上没有显示任何内容...
http://jsfiddle.net/gauravroy142/tZ7v2/ 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:[email protected] /cdn-cgi/l/email-protection">[email protected] /cdn-cgi/l/email-protection</a></p><br>
<p id="twitter"><a href="http://twitter.com/gauravroy11">@gauravroy11</a></p>
</div>
<p> </p>
<!--</div>-->
</div>
</body>
我也检查了 api 文档,但也没有用...地图没有显示任何内容。
您的地图 div #map-canvas(不是 #map)没有大小。
#map-canvas {
width:200px;
height:200px;
}
工作小提琴 http://jsfiddle.net/tZ7v2/1/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)