Skip to content
Snippets Groups Projects
Commit 2fd16d4b authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Add temporal navigation buttons to slider [GRIDV-68]

parent 4341afe7
No related branches found
No related tags found
No related merge requests found
......@@ -463,4 +463,20 @@ function getWarningStatusTitle(jsonDataStr, warningStatus)
: warningStatus == 3 ? gettext("Medium risk of infection")
: warningStatus == 4 ? gettext("High risk of infection") : "";
}
}
/**
* Programmatically move the slider back and forth
* Used by the arrow buttons (onclick event) on each side of the slider
* @param {Integer} step
*/
function moveDateSlider(step)
{
let slider=document.getElementById("layerDateRange");
let min = parseInt(slider.min);
let max = parseInt(slider.max);
let newValue = parseInt(slider.value) + step;
newValue = newValue > max ? max : newValue < min ? min : newValue;
slider.value=newValue;
slider.onchange();
}
\ No newline at end of file
......@@ -32,7 +32,9 @@
<div class="col-md-12" id="mapContainer" style="position: relative; height: 800px; padding-top: 15px; padding-bottom: 15px;">
<div class="slidecontainer" style="position: absolute; left: 20px; bottom: 20px; background-color: white; z-index: 1000;padding: 15px; border-radius: 15px;">
{% trans "Current date" %}: <span id="currentDate"></span> <br/>
<input type="range" min="0" max="0" value="0" step="1" id="layerDateRange" onchange="switchLayer(parseInt(this.value));"><br/>
<button type="button" class="btn" onclick="moveDateSlider(-1);"><i class="fa fa-step-backward" aria-hidden="true"></i></button>
<input type="range" min="0" max="0" value="0" step="1" id="layerDateRange" onchange="switchLayer(parseInt(this.value));">
<button type="button" class="btn" onclick="moveDateSlider(1);"><i class="fa fa-step-forward" aria-hidden="true"></i></button>
</div>
<div class="form-group" id="paramselector" style="position: absolute; right: 20px; bottom: 20px; background-color: white; z-index: 1000;padding: 15px; border-radius: 15px;">
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment