我正在创建一个电子商务网站,我想在其中添加Google Maps API吗?
我知道这是一件非常简单的事情,但我遇到了一个小问题,那么有人可以帮助我如何添加Google Maps API吗?
答案 0 :(得分:0)
如果你想添加一个没有iframe的地图,请查看这个jsfiddle
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
function initialize() {
var map_canvas = document.getElementById('map_canvas');
var map_options = {
center: new google.maps.LatLng(51.372658, 1.354386),
zoom:16,
mapTypeId: google.maps.MapTypeId.HYBRID
}
var map = new google.maps.Map(map_canvas, map_options)
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<style>
#map_canvas {
width: 500px;
height:400px;
border:1px solid #888888;
margin-bottom:20px;
box-shadow: 2px 2px 2px #888888;
}
</style>
</head>
<body>
<div id="map_canvas"></div>
</body>
您需要在此处更改您所在位置的经度和纬度。你可以从谷歌地图得到这个。要改变的部分是&#34;新的google.maps.LatLng(51.372658,1.354386)&#34;