diff --git a/spatial/static/spatial/js/gridmap.js b/spatial/static/spatial/js/gridmap.js index 249d75423294b4f138e5b0c1334bff68ee90de58..446c6ac1dc1bc876ed76608757c79b2e9986a77e 100644 --- a/spatial/static/spatial/js/gridmap.js +++ b/spatial/static/spatial/js/gridmap.js @@ -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 diff --git a/spatial/templates/spatial/gridmap.html b/spatial/templates/spatial/gridmap.html index 851f0ad39b9942403d1d3962a261b10008a06661..9d86686290c4512dc6623b4bc464722321b33e15 100644 --- a/spatial/templates/spatial/gridmap.html +++ b/spatial/templates/spatial/gridmap.html @@ -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>