2

好的,我正在使用 gmap jQuery 插件来创建 Google 地图。它有很多功能,而且似乎工作得很好。

这是插件页面的链接: http ://code.google.com/p/jquery-ui-map/

我正在使用 PHP/MySQL/jQuery/JSON 绘制我的标记 --- 我的点是按照他们应该的方式绘制的。

我的问题是我试图显示一个 jQuery 模态对话框,其中包含标记的街景。与此类似:http: //jquery-ui-map.googlecode.com/svn/trunk/demos/jquery-google-maps-streetview.html

当我点击标记时,我的代码最终会出现以下错误:

gmap h[b] is undefined Source

这是javascript:

$('#map').gmap().bind('init', function (evt, map) {
$.getJSON('controllers/markers.json', function (data) {
    $.each(data.markers, function (i, marker) {
        $('#map').gmap('addMarker', {
            'position': new google.maps.LatLng(marker.latitude, marker.longitude),
            'icon': "https://chart.googleapis.com/chart?chst=d_bubble_text_small&chld=bb|" + marker.projectNumber + "|0074b0|FFFFFF|",
            'bounds': true
        }).click(function () {
            var projNum = marker.projectNumber;
            var lat = marker.latitude;
            var lng = marker.longitude;
            var location = $(this).get(0).getPosition();
            map.panTo(location);
            $('#street').dialog({
                'modal': true,
                'width': 530,
                'height': 530,
                'title': projNum,
                'resizable': false,
                'draggable': false
            });
            $('#street').gmap('displayStreetView', 'panel', {
                'position': location
            });
        });
    });
});

});

这是#street div 的 HTML:

<div style="display:none;">
        <div id="street" style="height:200px;"></div>
</div>

当我提醒:projNum、lat、lng 变量时,我得到了正确的信息。

任何帮助将非常感激。

谢谢!

4

0 回答 0