我正在使用Google地图。根据服务过滤地图后出现的问题。它显示了不同的标记标签。
这是我的产品链接 https://cdn.assetrepository.me/maps-test/
here is the images showing marker
这是我用于过滤Google Maps标记的代码。
$('input[name="showroom_services"]').on("change", function(){
markerCluster.clearMarkers();
markers = [];
var searchField = $('#showroom_search').val();
var expression = new RegExp(searchField, "i");
var listfilterW=[];
var markerAlreadyMade=[];
$('input[name="showroom_services"]').each(function(){
if($(this).prop("checked")==true) {
let crRef=$(this);
$.each(jsondata, function(key, value) {
if(value.city.search(expression) !== -1){
if(value['services_list'].indexOf($(crRef).val()) !== -1)
if(markerAlreadyMade.indexOf(value.dealerId)==-1)
{
// console.log(value.['services_list'])
// if(value.city.search(expression) !== -1){
listfilterW.push(value);
markerAlreadyMade.push(value.dealerId)
}
}
});
}
})
if(listfilterW.length > 0){
$.each(listfilterW, function(key, value) {
drawMarkers(value, "null");
});
}else{
$.each(alldata, function(key, value) {
drawMarkers(value, "null");
});
}
$('.reset_filter').click(function(){
if(listfilterW.length > 0){
$('.dealer-item.list_active').removeClass('list_active');
markerCluster.clearMarkers();
markers = [];
}
});
});