Can't seem to figure out how to use JQueryUI Slider to change the layer display on my leaflet map. Scenario is basically, When user slides bar across a dfferent layer shows up on the map (in years) Below is the slider script
<script type="text/javascript">
// set up an array to hold the years
var years = [1111, 1112];
var activeYear =
$(".slider")
// activate the slider with options
.slider({
max: years.length-1,
value: activeYear
})
// add pips with the labels set to "years"
.slider("pips", {
rest: "label",
labels: years
})
// and whenever the slider changes, change map display layer
.on("slidechange", function(e,ui) {
**UNSURE OF CODE HERE**
});
</script>
My layers are listed earlier in the map script in a different div, a sample one is
var basemaps = {
oneoneoneone: L.tileLayer.wms("http://localhost:8080/geoserver/wms", {
layers: 'map:1111',
transparent: true,
version: '1.1.0',
format: 'image/png'
}),
Am i able to relate the oneoneoneone layer to the slider array value 1111 and then when slider is set on that section it will display the layer on the map?