Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Leaflet MarkerClusterGroup along with DeferredLayer plugin issue WordPress


We am looking for a solution for the issue also described at [[LINK href=""]][[/LINK]] respectively [[LINK href=""]][[/LINK]]

We think a possible solution could be to hock into an event (like [[LINK href=""]][[/LINK]]) and only add the markercluster once this event has been fired. Anyway we didnt come to a solution yet here.

We succeeded in a workaround by adding a timeout-function like
setTimeout(function(){...},1000); });
anyway solutions like that one are not qualified for a fix, as leaflet markercluster load fine on OpenStreetMap based maps for example and would delay the loading of markersclusters there too by 1 second for example.

Any help here would be appreciated!

Answers (2)


Ross Wilson answers:

I played with this for a little bit and by far the simplest example is to add the maxZoom when you initialize the map, like in this fiddle
[[LINK href=""]][[/LINK]]

Other than that, if you want to use the load event, you will have to just initialize the map without the coordinates and zoom, set the event, then initialize the map. Like I said, the example above is much simpler/cleaner

Robert Harm comments:

thx for prompt reply - anyway I am not sure if that would work within the context of the implementation in my plugins (see sourcecode at for an example). This is why I was initially looking for a solution based on events fired after map is available.
Anyway will check your suggestion & get back to you - if you could also have a look at the URL above to check if your solution would work here too, that would be great!

Ross Wilson comments:

I don't have the full view into your code, but it looks like you should be able to apply the same fix, passing a default of maxZoom: 1 into the object passed into new, the same place where you pass all the other options to the customized map in your plugin. In the page you linked above, it would be the same object where you are passing touchZoom: true, etc


Romel Apuya answers:

why does your pictures look same???