gpt4 book ai didi

jquery-ui - 删除 jquery 删除按钮上的所有 gmaps 标记

转载 作者:行者123 更新时间:2023-12-04 16:22:28 24 4
gpt4 key购买 nike

我将 jquery-UI-map 用于 gmap,当我单击 Gmap 上的 map 时,我想弹出窗口。

 $(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);}

但是标记仍然存在,有人请帮助我。谢谢

最佳答案

在插件版本 3 中,应该使用:

$('#map_canvas').gmap('clear', 'markers');

关于jquery-ui - 删除 jquery 删除按钮上的所有 gmaps 标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6756303/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com