私はgmapsにjquery-UI-mapを使用しています.Giapsのマップをクリックするとポップアップを作成します。私はこのコードでボタンを削除]をクリックすると、すべてのマーカーを削除するjqueryのすべてのgmapsマーカーを削除するremove button
$(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);}
しかし、マーカーはまだ誰かが私を助けてください、残っています。
"Remove": function() {
$(this).dialog("close");
$(map).clearMarkers();
}
あなたは天才johansalllarsson、ありがとうございます。できます ! –
Np、私はプラグインを書いたので、私は知っておくべきです:)。 Plsはあなたが時間があればいつでも答えを受け入れます:) – johansalllarsson
私はこのコードを呼び出すと 'Uncaught TypeError:プロパティを読み取れません' 'undefined'を適用します。 –