mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-07-05 21:58:53 +00:00
added slider for led brightness
This commit is contained in:
parent
a3dc701d0b
commit
e4fb246356
5 changed files with 65 additions and 7 deletions
14
data/range-input.js
Normal file
14
data/range-input.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
document.querySelector("form").addEventListener("input", (event) => {
|
||||
if (event.target.classList.contains("range")) {
|
||||
updateValue(event.target);
|
||||
}
|
||||
});
|
||||
|
||||
function updateValue(slider) {
|
||||
const percentage = Math.round((slider.value / slider.max) * 100);
|
||||
slider.nextElementSibling.innerText = `${percentage}%`;
|
||||
}
|
||||
|
||||
document.querySelectorAll("input[type='range'].range").forEach((element) => {
|
||||
updateValue(element);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue