我没有看到任何错误,但地图不会出现(使用github中的gmaps.js)

Dat*_*sik 5 google-maps google-maps-api-3

我正在尝试在github中使用GMaps.js,但由于某些原因它无法正常工作,我很确定我已将它输入正确,如果有人能指出我正确的方向,谢谢.(http://i.imgur.com/3LkL6xS.png实际照片,以防它在这里不够大.)

破碎的代码

这是新的源代码:

<!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>
Run Code Online (Sandbox Code Playgroud)

Ked*_*dor 14

正如我在评论中所说,你可能错过了div的宽度和高度,你可以尝试显示地图.

这是工作jsfiddle:jsFiddle玩

$(document).ready(function () {
    var map = new GMaps({
        div: '#basic_map',
        lat: 51.5073346,
        lng: -0.1276831,
        width: '500px',
        height: '500px',
        zoom: 12,
        zoomControl: true,
        zoomControlOpt: {
            style: 'SMALL',
            position: 'TOP_LEFT'
        },
        panControl: false
    });
});
Run Code Online (Sandbox Code Playgroud)

为代码添加了宽度和高度.
或者在这里你有相同的结果,宽度和高度在css.差别不大.