Skip to content
Advertisement

MarkerCluster markers are still showing behind cluster

I am trying to hide the markers behind my cluster and only have them show when the marker is clicked.

This is how it appears:

This is how it appears. However when I click the cluster and exit it, it goes back to how it should look (second pic)

However when I click the cluster and exit it, it goes back to how it should look (second pic)

This is how I want it to look originally

(This is how I want it to look originally)

This is my code:

JavaScript

Advertisement

Answer

You are adding the created marker to the map too and this is wrong (icon: carIcon }).addTo(mymap).bindPopup().

Change

JavaScript

to

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement