我使用jquery-UI-map作为gmaps,我想在点击Gmaps上的地图时弹出窗口.
$(function() {
$('#map_canvas').gmap( {'center': new google.maps.LatLng(-0.789275, 113.921327), 'callback': function(map) {
$(map).click( function(event) {
$('#map_canvas').gmap('addMarker', {'position': event.latLng, 'title': '', 'draggable': true, 'bound': false}, function(map, marker) {
$('#test').dialog({'modal':true, 'title': 'Edit and save point', 'buttons': {
"Remove": function() {
$(this).dialog( "close" );
$(map).setMap(null);
},
"Save": function() {
$(this).dialog( "close" );
}
}});
findLocation(marker.getPosition(), marker);
}).dragend( function(event) {
var self = this;
findLocation(event.latLng, this);
}).click( function() {
openDialog(this);
})
});
}});
Run Code Online (Sandbox Code Playgroud)
我想在此代码中单击删除按钮时删除所有标记:
"Remove": function() {
$(this).dialog( "close" );
$(map).setMap(null);}
Run Code Online (Sandbox Code Playgroud)
但标记仍然存在,有人请帮助我.谢谢
我想在我的项目中使用gMap jQuery插件。我成功显示了Google地图,可以显示一些标记,但是找不到任何方法绘制多段线。
我有这个JS代码:
$(window).ready(function () {
var data = {
'latitude': 0.000000,
'longitude': -180.000000,
'zoom': 3,
'maptype': "terrain",
};
var gps_coordinates = {
strokeColor: "#FF0000",
strokeOpacity: 1.0,
strokeWeight: 2,
path: [
{'latitude':37.772323,'longitude':-122.214897},
{'latitude':21.291982,'longitude':-157.821856},
{'latitude':-18.142599,'longitude':178.431000},
{'latitude':-27.467580,'longitude':153.027892}
]
};
$('#map').gMap(data);
$('#map').gMap("Polyline", gps_coordinates);
});
Run Code Online (Sandbox Code Playgroud)
在gMap文档中的注释如下:
您还可以使用一些内部gmap函数。
所以我想,我可以使用google.maps.Polyline函数绘制一条折线。但是如何?