Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setLeftLayers not working #37

Open
emadbaqeri opened this issue Mar 6, 2021 · 2 comments
Open

setLeftLayers not working #37

emadbaqeri opened this issue Mar 6, 2021 · 2 comments

Comments

@emadbaqeri
Copy link

Any idea how to implement setLeftLayer functionality

@nathanrooy
Copy link

@emadbaqeri, I found that this worked for me...

var map = L.map('map').setView([51.505, -0.09], 13);
var myLayer1 = L.tileLayer(...).addTo(map);
var myLayer2 = L.tileLayer(...).addTo(map);

var sideBySide = L.control.sideBySide([], []).addTo(map);
sideBySide.setLeftLayers([myLayer1]);
sideBySide.setRightLayers([myLayer2]);

Then simply update with the following:

var myLayer3 = L.tileLayer(...).addTo(map)
sideBySide.setLeftLayers([myLayer3]);

I actually remove the left layers before adding new ones, buy your situation might be different...

@emadbaqeri
Copy link
Author

emadbaqeri commented Apr 11, 2021

@nathanrooy Thank you friend. This is the best solution that I can implement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants