elesdoar / leaflet-control-orderlayers

Leaflet control with order functionality
http://elesdoar.me/leaflet-control-orderlayers/
MIT License
30 stars 10 forks source link

Layers order at start #2

Closed aborruso closed 10 years ago

aborruso commented 10 years ago

Hi, first of all thank you for this plugin.

I have a stupid question: how to set the Layers order at start?

The first layer in my list is that one with zIndex 3, and it's before those with zIndex 2 and 1. Why the firt is not the one with zIndex 1?

This is my example page: http://aborruso.github.io/monferrato/index_3.html

Thank you

elesdoar commented 10 years ago

Hi,

Update this new option in the last update: Commit: 50adce177f485919c99561bf43dda41dc7432d1f

L.control.orderlayers(baseLayers, overlayLayers, {collapsed: false, order: 'normal' });

For inverse order:

L.control.orderlayers(baseLayers, overlayLayers, {collapsed: false, order: 'qgis' });

Thanks. Good luck. :+1:

aborruso commented 10 years ago

Hi @elesdoar , thank you again, but there is something strange.

Look again at this page: http://aborruso.github.io/monferrato/index_3.html

If you look at the code of the layer checked at startup and named "Dopo il 1684", it has zindex = 1 https://github.com/aborruso/monferrato/blob/gh-pages/index_3.html#L174

But it's the fourth in layers order. Do you know why?

Best regards