以下是地图的简单再现,测试添加了 Google 地图 jQuery v.3:
<!DOCTYPE html>
<head>
<title>Google Maps JQuery Plugin Test</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery /1.7/jquery.min.js"></script>
<script type="text/javascript" src="PATH_TO_PLUGIN/jquery.ui.map.js"></script>
<script type="text/javascript">
$('#map_canvas').gmap({
'some_option': 'some_value'
}); // Add the contructor
// addMarker returns a jQuery wrapped google.maps.Marker object
var $marker = $('#map_canvas').gmap('addMarker', {
'position': '57.7973333,12.0502107',
'bounds': true
});
$marker.click(function () {
$('#map_canvas').gmap('openInfoWindow', {
'content': 'Hello World!'
}, this);
});
</script>
</head>
<body>
<div id="map_canvas" style="width:250px;height:250px"></div>
</body>
</html>