for me is too difficult show NOT ALL markers on google maps. I have many markers and each has a zIndex. I have 3 buttons where, if is clicked, i could add or remove a range of these markers.
$('#a, #b, #c').on('click', function(){
if ($(this).attr('id') == 'a'){
add_del(1,arg);
}
else if($(this).attr('id') == 'b'){
add_del(2,arg);
}
else if($(this).attr('id') == 'c'){
add_del(3,arg);
}
});
function add_del(arg,stato){
if(arg == 1){
var a= 10;
var b= 8;
}
else if(arg== 2){
var a= 8;
var b= 6;
}
else{
var a= 6;
var b= 4;
}
if(stato == "add"){
stato= map;
}
else if(stato== "delete"){
stato= null;
}
for(var x=0; x < markers.length; x++){
var index= (markers[x].getZIndex())+0;
if((index <= a) && (index => b)){
markers[x].setMap(stato);
}
}
}
If the button is active, at the click, i remove its markers. If the button is not active, at the click, i add its markers.
The code in example is simplified but i can assure you that works...the problem is this:
if i click on #c
markers with zIndex between 6 and 4 are removed.
Then if i click on #b
also markers with zIndex between 8 and 6 are removed.
But if i click another time on #b
(and active it) will add ALL markers !
This isn't correct because should add only markers of #b
, so with zindex between 8 and 6.
I don't understand where is the problem: maybe when i for loop array of markers ?
I hope you can help me.
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I'm using Laravel (55) with Backpack
I am using FullCalendar scheduler into my project, and I have a timeline Month view that I declare it like this:
I have a Html String and I want to parse it to html and then remove any pre tags and it's childrenI tried this:
I need a jQuery background fader from background to background