Show markers on top of marker clusterers
I have a single marker which I want to get rendered on top of everything. Setting z-index did not help me as I learned marker clusterers and markers get rendered in different layers. This is the current situation:
As you see the person marker is covered by the clusterers. I found this link for a workaround: https://philipwalton.com/articles/what-no-one-told-you-about-z-index/
It says that setting a difference in opacity helps seeing specific objects in the front. But as I set opacity property of the marker, it isn't helping much.
Props:
{
position: {
lat: address.lat,
lng: address.lon,
},
title: customTitle,
defaultOptions: {
optimized: false,
},
defaultOpacity: 1.00,
opacity: 1.00,
zIndex: customzIndex,
}
Any kind of help will be much appreciated.
I have the same problem too, it is anoying the cluster icons don't wont respect the z-indexes of non cluster icons. I will report here if i find a solution.
That link you found is not the solution you are looking for. It is an old solution for z-indexes in css. Google maps uese the same name for the same concept but is not the same thing.
@erikhuisman Thanks for the response. Actually the technique in the given link worked for me. The process was:
- Assign a large value as z-index for the markers.
- Using css grab the element using that specific z-index.
- Make opacity to 1.0
However, I guess most may agree with me that this is not a neat process. Kind of a workaround. So if there is a way to do it using library or something that I don't know of the library, it would be better.
Should be the underlying problem of MarkerClustererPlus. https://github.com/mikesaidani/marker-clusterer-plus