gmapsにjquery-UI-mapを使用していますが、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);
})
});
}});
このコードで削除ボタンをクリックしたときにすべてのマーカーを削除したい:
"Remove": function() {
$(this).dialog( "close" );
$(map).setMap(null);}
しかし、マーカーはまだ残っています、誰かが私を助けてください。ありがとうございました