leaflet-timeline-slider icon indicating copy to clipboard operation
leaflet-timeline-slider copied to clipboard

Add an option for initial/starting value

Open zharfanzahisham opened this issue 2 years ago • 5 comments

Hi! First of all, amazing plugin! :)

Is it possible to add an option to initialize the value? For example, I have 3 timelineItems ("Yesterday", "Today", "Tomorrow") and I want the thumb/value to be initialized at "Today" instead of "Yesterday".

Thanks in advance!

zharfanzahisham avatar Jan 06 '23 08:01 zharfanzahisham

Hi! Thank you, and great question. I will try to add that initialization option as soon as possible.

svitkin avatar Jan 11 '23 15:01 svitkin

Hi, is there any improvement regarding this request? It would help me a lot as well :)

shlommer avatar May 29 '24 07:05 shlommer

Just add options initializeValue: 1, and in slider.innerHTML replace value="1" with value="${this.options.initializeValue}"

lexflex64 avatar Jul 17 '24 08:07 lexflex64

In my case timelineItems it's a array of date timelineItems: dateTtile with initializeValue:dateTtile.length i initialise the timeline to the end

lexflex64 avatar Jul 17 '24 08:07 lexflex64

You have to add if(this.options.initializeValue>1){ that.sheet.textContent += that.getTrackStyle(this.rangeInput, that.sliderLength); } before /* When input gets changed change styles on slider and trigger user's changeMap function */ L.DomEvent.on(this.rangeInput, "input", function() { to initialise the range

lexflex64 avatar Jul 17 '24 09:07 lexflex64