我試圖使用GMaps.js in github,但由於某種原因,它不工作,我敢肯定,我輸入了它是正確的,如果有人能指出我在正確的方向感謝。 (萬一http://i.imgur.com/3LkL6xS.png真實照片是不是在這裏不夠大。)我沒有看到任何錯誤,但地圖不會出現(使用github中的gmaps.js)
這裏是新的源代碼:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://maps.google.com/maps/api/js?key=AIzaSyBi7e8AiTyqWiFt9vlbGqsAzGyRhVWqCsk&sensor=true"></script>
<script src="js/gmaps.js"></script>
<script>
/**
* Basic Map
*/
$(document).ready(function(){
var map = new GMaps({
div: '#basic_map',
lat: 51.5073346,
lng: -0.1276831,
zoom: 12,
zoomControl : true,
zoomControlOpt: {
style : 'SMALL',
position: 'TOP_LEFT'
},
panControl : false,
});
});
</script>
</head>
<body>
<div id="basic_map"></div>
</body>
</html>
您使用過「el」,但我在例子中看到它們使用'div:'#map','來顯示哪個div映射應該出現,並且您確定您擁有「#basic_map」div大到足以顯示任何內容? (在CSS中的寬度和高度) – Kedor 2013-03-03 08:29:44
可悲的是,沒有解決它。 – Datsik 2013-03-03 08:37:12
地圖加載到您的頁面中,但您缺少高度,這就是爲什麼即使加載地圖也沒有看到地圖的原因。指定Gmap選項或CSS中的高度,問題將被修復。 Kedor的回答下面指出了你的問題的實際解決方案。 – 2013-03-03 10:13:51