Working slider, resets after sliding

This commit is contained in:
2022-12-27 16:39:07 +01:00
commit 7ae2c22077
2 changed files with 64 additions and 0 deletions

22
index.html Normal file
View File

@ -0,0 +1,22 @@
<head>
<body>
<form action="/button_pressed" method="get">
<label for="brightness">Brightness:</label>
<input type="range" id="brightness" name="brightness" min="0" max="100" onmouseup="updateBrightness(this.value)" ontouchend="updateBrightness(this.value)">
<output id="brightness-value"></output>
</form>
<script>
function updateBrightness(value) {
document.querySelector('#brightness-value').innerHTML = value;
window.location.href = '/button_pressed?' + value;
}
function submitForm(event) {
// Prevent the default form submission behavior
event.preventDefault();
// Submit the form manually
document.querySelector('form').submit();
}
</script>
</body>
</head>